fix(wikidoc): sanitize generated MDX - #96
Merged
Merged
Conversation
(cherry picked from commit f9a70b3)
ss-o
marked this pull request as ready for review
July 26, 2026 18:25
There was a problem hiding this comment.
Pull request overview
Promotes the wikidoc sanitizer updates to ensure gomarkdoc-generated Markdown is safe and correctly rendered as Docusaurus MDX in the wiki sync pipeline (method anchors resolve, inline code renders as code, and brace-containing examples don’t break MDX parsing).
Changes:
- Convert Markdown-indented code blocks into fenced code blocks to avoid MDX interpreting braces as expressions.
- Restore gomarkdoc plain-format escaped inline-code spans by unescaping Markdown punctuation and decoding entities only within paired spans.
- Rewrite receiver-method fragment links (e.g.,
#Backquotes.Analyze) to the Docusaurus slugs derived from the corresponding headings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/wikidoc/wikidoc.go | Extends Sanitize with fenced-block conversion, inline-code restoration, and method-fragment slug rewriting for MDX compatibility. |
| internal/wikidoc/wikidoc_test.go | Adds regression tests covering method anchor rewrites, inline-code restoration, and indented-to-fenced code conversion edge cases. |
This was referenced Jul 26, 2026
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.
Summary
Promote the exact two-file wikidoc sanitizer change from merged
nextPR #94 tomain.nextPromotion integrity
maininternal/wikidoc/wikidoc.goandinternal/wikidoc/wikidoc_test.gochangenextcommitf9a70b35809dca024b28d359b02a008dc506493dThe pre-existing red
mainbaseline was repaired separately by #95, which closed #91 before this promotion was rebased.Impact
The next main-branch wiki sync can update existing wiki PR #798 with working method anchors, correctly rendered inline code, and fenced brace-containing examples. This also addresses the locally reproduced Cloudflare Pages MDX failure.
Verification
go test ./...go vet ./...GOFLAGS=-buildvcs=false go build ./...trunk check internal/wikidoc/wikidoc.go internal/wikidoc/wikidoc_test.gonextCloses #89.
Related: #85, #94, #95, z-shell/wiki#798.