Skip to content

fix: decode XML entities in generated rustdoc#521

Open
0rlych1kk4 wants to merge 1 commit into
mavlink:masterfrom
0rlych1kk4:fix/rustdoc-double-escaping
Open

fix: decode XML entities in generated rustdoc#521
0rlych1kk4 wants to merge 1 commit into
mavlink:masterfrom
0rlych1kk4:fix/rustdoc-double-escaping

Conversation

@0rlych1kk4

Copy link
Copy Markdown
Contributor

What changed

quick-xml emits escaped XML entities as Event::GeneralRef. The parser was rebuilding those references as literal strings such as & and <, which meant rustdoc escaped them again in the generated documentation.
This change resolves predefined XML entities while parsing descriptions, so generated docs contain the intended characters.

For example:

(Dev & 0xff) << 24

is now generated as:

(Dev & 0xff) << 24

Unknown entity references are left unchanged.

Tests

  • added a small escaped_html.xml fixture
  • added snapshot coverage for & and < inside a Markdown code span
  • updated existing snapshots where > and -> are now decoded

Validation

cargo test -p mavlink-bindgen
cargo test -p mavlink-bindgen --test e2e_snapshots
cargo fmt --all -- --check
git diff --check

Closes #506 .

Signed-off-by: 0rlych1kk4 <orlychikka@gmail.com>
@onur-ozkan
onur-ozkan self-requested a review July 15, 2026 13:38
@pv42

pv42 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

lgtm 👍

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.

Escaped HTML charchters in backticks are documented escaped.

2 participants