Repository navigation
Keep explicit heading ids in the .md export - #94
Merged
Merged
Conversation
Signed-off-by: Kristin Brown <kristin.brown@solo.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
.mdoutput format dropped explicit heading ids. A heading written as### Install kagent with Helm {#install-kagent-helm}came out of the export as a plain### Install kagent with Helm. Hextra puts the id on a<span>inside the heading, andtransform.HTMLToMarkdowndrops it.In-page links such as
[install kagent](#install-kagent-helm)then pointed at nothing in the.mdfile. The Lychee link check scans the.mdexports, so it reported "Cannot find fragment" even though the HTML page was correct. For example, the kagent link check on kagent-dev/website#738 reports four of these warnings (kagent-dev/website#737):kagent/{main,latest}/setup/installation.md#install-kagent-helmkagent/{main,latest}/agents/egress-policies.md#origin-formatWhat changed
layouts/_partials/page-to-markdown.html. Before the HTML-to-Markdown conversion, the partial marks each heading whose id differs from the slug of its text. After the conversion, it restores that id as a{#id}heading attribute. Headings with auto-generated ids are left alone, so the export stays clean.tests/md-heading-ids.spec.ts, added to thestaticproject'stestMatchallowlist inplaywright.config.ts.CHANGELOG.mdentry under Unreleased.The Copy as Markdown button (
copy-markdown.html) is unchanged.Testing
md-heading-ids.spec.tspasses against the OSS fixture..mdpages now carry{#install-kagent-helm}and{#origin-format}, and an offline Lychee run with--include-fragmentsover every.mdexport reports 0 fragment errors.mainbuild.After merge
Tag a release, then bump the
docs-theme-extraspin in consumers (kagent is on v0.5.0) to clear the warnings.🤖 Generated with Claude Code