Skip to content

fix(wikidoc): sanitize generated MDX - #96

Merged
ss-o merged 1 commit into
mainfrom
codex/hotfix-89-wikidoc-mdx
Jul 26, 2026
Merged

fix(wikidoc): sanitize generated MDX#96
ss-o merged 1 commit into
mainfrom
codex/hotfix-89-wikidoc-mdx

Conversation

@ss-o

@ss-o ss-o commented Jul 26, 2026

Copy link
Copy Markdown
Member

Summary

Promote the exact two-file wikidoc sanitizer change from merged next PR #94 to main.

  • rewrite gomarkdoc receiver-method fragments to Docusaurus slugs
  • restore escaped punctuation and entities inside paired inline-code spans
  • convert generated Markdown-indented examples to fenced code blocks
  • retain the regression coverage reviewed on next

Promotion integrity

  • one signed commit based directly on repaired main
  • only internal/wikidoc/wikidoc.go and internal/wikidoc/wikidoc_test.go change
  • both promoted file blobs exactly match merged next commit f9a70b35809dca024b28d359b02a008dc506493d
  • cherry-pick provenance is retained without a prohibited co-author trailer

The pre-existing red main baseline 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.go
  • regenerated wiki frontmatter validation
  • regenerated wiki English production build
  • exact file-blob comparison against merged next

Closes #89.

Related: #85, #94, #95, z-shell/wiki#798.

@ss-o
ss-o marked this pull request as ready for review July 26, 2026 18:25
Copilot AI review requested due to automatic review settings July 26, 2026 18:25
@ss-o
ss-o merged commit d390a96 into main Jul 26, 2026
7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants