Skip to content

fix: ignore RDS USERMACRO definition metadata - #52

Merged
eitsupi merged 1 commit into
mainfrom
fix/rds-usermacro-leakage
Jul 23, 2026
Merged

eitsupi merged 1 commit into
mainfrom
fix/rds-usermacro-leakage

Conversation

@eitsupi

@eitsupi eitsupi commented Jul 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Ignore the RDS USERMACRO definition marker when converting inline nodes.
  • Keep ordinary Raw nodes available for lossless fallback and paragraph scanning.
  • Add an original MIT-compatible regression fixture that models the RDS marker/expansion shape.

This fixes malformed help output such as duplicated macro metadata (#1GhostScriptGhostScript) when arf reads installed R help from RDS and converts it with rd2qmd 0.5.0-alpha.1.

Verification

  • Reproduced the issue through the latest arf installed-RDS path.
  • Confirmed the fix against the same path using a local patched rd2qmd-core.
  • cargo fmt --all -- --check
  • cargo test --all-targets --all-features --workspace
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • git diff --check

The regression fixture is original test data and does not copy GPL-licensed grDevices sources or documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes malformed Quarto/Markdown output when converting Rd content sourced from R help databases (RDS), by detecting and ignoring the USERMACRO definition marker nodes so their producer metadata (e.g., #1...) is not rendered alongside the already-expanded sibling content.

Changes:

  • Add a shared is_usermacro_definition() helper to identify validated RDS USERMACRO definition markers.
  • Skip USERMACRO definition markers during inline conversion and paragraph/block-content scanning to prevent duplicated macro metadata in rendered output.
  • Add an original regression test fixture modeling the RDS USERMACRO marker/expansion shape.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/rd2qmd-core/src/convert_ast/mod.rs Introduces is_usermacro_definition() helper used to recognize the RDS USERMACRO definition marker.
crates/rd2qmd-core/src/convert_ast/traversal.rs Avoids scanning USERMACRO definition marker Raw children into paragraph content (prevents metadata from influencing paragraph output).
crates/rd2qmd-core/src/convert_ast/inline.rs Skips rendering USERMACRO definition markers during inline conversion; adds a regression test to ensure only the expansion is rendered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eitsupi
eitsupi merged commit 588a301 into main Jul 23, 2026
14 checks passed
@eitsupi
eitsupi deleted the fix/rds-usermacro-leakage branch July 23, 2026 09:57
eitsupi added a commit that referenced this pull request Jul 26, 2026
PR #52 and #55 fixed regressions introduced by the rd-ast/rd-source
migration (#50) itself, and only ever affected the unpublished
0.5.0-alpha.1/beta.1 pre-releases. Listing them as user-facing fixes
in the 0.5.0 changelog is misleading since no stable release ever
shipped with these bugs.
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.

2 participants