fix: help browser can now open vignettes and demos#80
Merged
Conversation
Add htmd 0.5 to workspace and arf-harp for converting vignette HTML to Markdown in the help browser. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add get_vignette_text() to retrieve vignette HTML via R's utils::vignette() and convert to Markdown using htmd. PDF vignettes are detected and return a descriptive error. Also extract eval_r_to_string() helper to reduce duplication with get_help_text(), and add strip_pandoc_anchors() to clean Pandoc line-number anchor artifacts from converted Markdown. Co-Authored-By: Claude Opus 4.6 <[email protected]>
When selecting a help topic, now check entry_type to handle different content types appropriately: - "help": existing behavior via get_help_text() + Rd2txt - "vignette": HTML-to-Markdown conversion via get_vignette_text() - "demo": show message suggesting demo() command to run in R Vignette errors (e.g. PDF format) are displayed in the pager instead of being silently logged. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
…lation Defensive fix: the sentinel constant is now passed through escape_r_string() when interpolated into R code, preventing potential breakage if the sentinel value were ever changed to contain R-special characters. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ghlighting Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Updates the terminal help browser to properly handle non-help entries returned by R’s help index (vignettes and demos), including rendering HTML vignettes as Markdown for display.
Changes:
- Added an internal
eval_r_to_string()helper to reduce repeated R-FFI evaluation boilerplate. - Implemented vignette loading + HTML→Markdown conversion (via
htmd), including a user-facing message for PDF vignettes. - Updated the help browser selection behavior to open vignettes/demos appropriately, and added
strip_pandoc_anchors()with unit tests.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/arf-harp/src/help.rs | Adds shared R-eval helper, vignette retrieval + HTML→Markdown conversion, and Pandoc-anchor stripping + tests. |
| crates/arf-harp/Cargo.toml | Adds htmd as a crate dependency via workspace. |
| crates/arf-console/src/pager/help.rs | Routes selected entries by type: vignette/demos now open with appropriate content/messages. |
| Cargo.toml | Adds workspace dependency version for htmd. |
| Cargo.lock | Locks htmd and its transitive dependencies. |
| CHANGELOG.md | Documents the fix under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix CString error message to describe NUL byte issue instead of UTF-8 - Fix PDF vignette and demo message indentation caused by line continuation with leading whitespace - Use raw strings to avoid unnecessary escape sequences
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
demo()command to runeval_r_to_string()helper to reduce R evaluation boilerplatestrip_pandoc_anchors()to clean up Pandoc-generated empty anchor artifactsTest plan
strip_pandoc_anchors()(6 cases):help→ search for a vignette (e.g.groupingfrom dplyr) → select it → verify Markdown displayed:help→ search for a demo (e.g.colorsfrom grDevices) → select it → verify message shown🤖 Generated with Claude Code