Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Add downlit support for github_document() #2284

Open
cderv opened this issue Jan 14, 2022 · 2 comments
Open

[FR] Add downlit support for github_document() #2284

cderv opened this issue Jan 14, 2022 · 2 comments
Labels
feature a feature request or enhancement next to consider for next release

Comments

@cderv
Copy link
Collaborator

cderv commented Jan 14, 2022

Following #1881, it would be interesting to add downlit auto-linking support for github_document() format.

For syntax highlighting, I don't think it would play well in a github markdown .md document.

@cderv cderv added feature a feature request or enhancement next to consider for next release labels Jan 14, 2022
@cderv cderv moved this to Backlog in R Markdown Team Projects Jan 14, 2022
@cderv cderv moved this from Backlog to Todo in R Markdown Team Projects Jan 14, 2022
@cderv
Copy link
Collaborator Author

cderv commented Jan 14, 2022

Currently, downlit_md_path() will do the autolinking but also the highlighting. This will generate some html code for the highlighting that won't be useful for Github rendering.

However, we could do it probably as it does not harm to have this html element - it will just clutter the diff in Github on the README. A proof of concept has been done already with this example here https://github.com/r-prof/procmaps/blob/main/README.md from initial PR r-lib/downlit#43 by @krlmlr
Autolinking is done and correctly works on Github. However if we look at the source (https://github.com/r-prof/procmaps/blob/main/README.md?plain=1), it contains chroma class on the pre and span with attributes that Github doesn't know how to handle.

If downlit is able to do it, we could offer only auto linking on inline code as this will write markdown only:

This in Rmd

See `ggplot2::ggplot()`

becomes this in resulting md file

See [`ggplot2::ggplot()`](https://ggplot2.tidyverse.org/reference/ggplot.html)

Something like

output:
  github_document:
    code_linking: true

This way, we could have cleaner md file with half of downlit feature

@hadley did you have in mind specific behavior when closing r-lib/downlit#26 and r-lib/downlit#43 ?

@hadley
Copy link
Member

hadley commented Jan 18, 2022

@cderv nope, nothing specific that I can recall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement next to consider for next release
Projects
Status: Backlog
Development

No branches or pull requests

2 participants