Skip to content

fix: help browser can now open vignettes and demos#80

Merged
eitsupi merged 7 commits intomainfrom
fix/help-browser-vignette-demo
Feb 14, 2026
Merged

fix: help browser can now open vignettes and demos#80
eitsupi merged 7 commits intomainfrom
fix/help-browser-vignette-demo

Conversation

@eitsupi
Copy link
Copy Markdown
Owner

@eitsupi eitsupi commented Feb 14, 2026

Summary

  • Vignettes selected in the help browser are now displayed as Markdown (converted from HTML via htmd)
  • Demo entries show a message with the demo() command to run
  • PDF vignettes show an explanatory message (cannot be rendered in terminal)
  • Extracted eval_r_to_string() helper to reduce R evaluation boilerplate
  • Added strip_pandoc_anchors() to clean up Pandoc-generated empty anchor artifacts

Test plan

  • Unit tests for strip_pandoc_anchors() (6 cases)
  • Manual: :help → search for a vignette (e.g. grouping from dplyr) → select it → verify Markdown displayed
  • Manual: :help → search for a demo (e.g. colors from grDevices) → select it → verify message shown
  • Manual: verify regular help topics still work as before

🤖 Generated with Claude Code

eitsupi and others added 6 commits February 14, 2026 12:48
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]>
…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]>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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
@eitsupi eitsupi merged commit 002fe52 into main Feb 14, 2026
10 checks passed
@eitsupi eitsupi deleted the fix/help-browser-vignette-demo branch February 14, 2026 14:01
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