Repository navigation
fix: ignore RDS USERMACRO definition metadata - #52
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 RDSUSERMACROdefinition markers. - Skip
USERMACROdefinition 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
USERMACROmarker/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.
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
USERMACROdefinition marker when converting inline nodes.Rawnodes available for lossless fallback and paragraph scanning.This fixes malformed help output such as duplicated macro metadata (
#1GhostScriptGhostScript) whenarfreads installed R help from RDS and converts it with rd2qmd 0.5.0-alpha.1.Verification
arfinstalled-RDS path.rd2qmd-core.cargo fmt --all -- --checkcargo test --all-targets --all-features --workspacecargo clippy --workspace --all-targets --all-features -- -D warningsgit diff --checkThe regression fixture is original test data and does not copy GPL-licensed
grDevicessources or documentation.