r-lib/pkgload

Supply macro definitions in print.dev_help

hadley opened this issue · 5 comments

print.dev_topic() — the documentation suggests that ... in Rd2txt() and Rd2html() is passed on to parse_Rd(). I don't remember exactly what you need to supply in the macros argument, but I'm pretty sure I got it working in pkgdown.

Would also need to work with the IDE team to get the necessary information passed along to the previewRd() API call.

This has come up in this discussion: https://stat.ethz.ch/pipermail/r-package-devel/2020q2/005420.html. The mathjaxr package supplies macros to allow MathJax to be used in Rd help files; packages need to list it in the RdMacros field in DESCRIPTION. pkgload::load_rd_macros() should be looking there.

IIUC, this is a duplicate of #115 which was fixed in #116. Am I missing something @hadley?

@lionel- I think @dmurdoch is saying that the current support is incomplete — as well as loading the macros defined in the current package, we also need to load the packages provided by the packages listed in the RdMacros field.

ok I think I understand now, we already have support for foreign and local RdMacros outside RStudio that Gabor implemented in #116. I have added unit tests in #205 (see also e3c282a which fixes a bug in RStudio introduced in this PR).

What was missing is support inside RStudio because we call into the IDE API in that case. @dmurdoch opened an issue about foreign macros in rstudio/rstudio#6871 which has been fixed by Kevin since. However, it seems that local macros are still not loaded. I have opened rstudio/rstudio#11336 to get this fixed.

I think we can now close this but please let me know if I'm still missing something.

Kevin found a way for us to display our own generated html files in the help pane of RStudio.