Skip to content

Fix Markdown docs with source-like syntax - #1673

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
subotac:fix/markdown-doc-brace-indentation
Jul 30, 2026
Merged

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

Conversation

@subotac

@subotac subotac commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

@alexcrichton
alexcrichton added this pull request to the merge queue Jul 30, 2026
Merged via the queue into bytecodealliance:main with commit 4ac8eaa Jul 30, 2026
29 checks passed
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 }

2 participants