Skip to content

Fix Markdown docs with source-like syntax - #1673

Open
subotac wants to merge 1 commit into
bytecodealliance:mainfrom
subotac:fix/markdown-doc-brace-indentation
Open

Fix Markdown docs with source-like syntax#1673
subotac wants to merge 1 commit into
bytecodealliance:mainfrom
subotac:fix/markdown-doc-brace-indentation

Conversation

@subotac

@subotac subotac commented Jul 29, 2026

Copy link
Copy Markdown

Fixes #1480.

Markdown doc text was passed through Source::push_str, which treats braces as generated-code structure. A doc line beginning with } could therefore reduce the tracked indentation before the
surrounding documentation block was deindented, causing an overflow panic.

Add a literal append path that preserves indentation without interpreting source syntax, use it for Markdown documentation, and cover the reported input with regression tests.

Tests

  • cargo test -p wit-bindgen-core -p wit-bindgen-markdown
  • cargo clippy -p wit-bindgen-core -p wit-bindgen-markdown --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • CLI generation using the reported WIT input

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

markdown: panic via doc line starting with }

1 participant