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

Consider enabling autolink extension in markdown_xml #1474

Closed
jeroen opened this issue Mar 21, 2023 · 3 comments
Closed

Consider enabling autolink extension in markdown_xml #1474

jeroen opened this issue Mar 21, 2023 · 3 comments

Comments

@jeroen
Copy link
Member

jeroen commented Mar 21, 2023

The gfm autolink extension will automatically detects URLs and email addresses in markdown text and turn them into hyperlinks. See gfm-autolink spec for details.

roxygen2/R/markdown.R

Lines 213 to 216 in a34bdf7

md_to_mdxml <- function(x, ...) {
md <- commonmark::markdown_xml(x, hardbreaks = TRUE, extensions = "table", ...)
xml2::read_xml(md)
}

Additional benefit is that this prevents a URLs from getting spell-checked as if they were plain text.

@hadley
Copy link
Member

hadley commented Nov 2, 2023

Yeah, sounds like a good idea.

@hadley hadley added this to the v7.2.4 milestone Nov 2, 2023
@hadley
Copy link
Member

hadley commented Nov 16, 2023

I tried turning this on and it broke a test because surprisingly it will autolink the url in this text:

#' [link % text](https://foo.bar/link%20target)

This is probably not coming from commonmark directly, but something we're for our hybrid Rd-md mode, but either way I don't think it's worth running down in more depth as the parser is already pretty fragile.

@hadley hadley closed this as completed Nov 16, 2023
@jeroen
Copy link
Member Author

jeroen commented Nov 16, 2023

Fair enough, thanks for giving it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants