reprex icon indicating copy to clipboard operation
reprex copied to clipboard

Process the output with downlit

Open krlmlr opened this issue 3 years ago • 1 comments

for formats that support it? This would provide clickable links for function calls and package names.

krlmlr avatar Mar 13 '21 05:03 krlmlr

I thought there already was an issue for this, but apparently it existed only in my head (and in conversations with @Hadley). Yes, it's an interesting idea!

jennybc avatar Mar 13 '21 16:03 jennybc

Re-read this today.

I'm not convinced that applying downlit is a natural job for reprex. It feels more like a job for rmarkdown. And then reprex could find appropriate ways to take advantage of that.

It seems that rmarkdown has added downlit support for html_document(), which is currently not used by reprex.

https://github.com/rstudio/rmarkdown/blame/0e4f5781d54cb903f047eb7eb80425a3e6b28875/NEWS.md#L94

This is related to #384, which calls for a re-examination of how reprex exploits (or does not exploit) output formats maintained in rmarkdown.

I'm closing for now. It's a good idea, but currently would require way more work than I can invest. I would reconsider if rmarkdown added downlit support to a markdown-y output format which I could then adopt or modify.

jennybc avatar Aug 16 '22 22:08 jennybc

I note that downlit does already offer .md support:

https://downlit.r-lib.org/reference/downlit_md_path.html

This is still something that would have to be analyzed when doing major work on the output format, which is #384.

Note that downlit_md_path() takes .md as input, but it seems to (often?) output .html. Perhaps this is user error on my part but that's what I'm seeing when I run the output of reprex() through downlit, so perhaps this depends on the content of the .md input. Maybe something related to comments?

jennybc avatar Aug 17 '22 01:08 jennybc