r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
9 stars 2 forks source link

On r-universe package websites some url syntax such as `<doi:>` in DESCRIPTION files doesn't render as hyperlinks #424

Closed remlapmot closed 3 months ago

remlapmot commented 3 months ago

This is a super minor issue but I thought I'd check if you'd spotted it.

In the Description: field of the DESCRIPTION file (and I guess in helpfile documentation as well) r-universe doesn't render some R linking syntax as URLs. These are <doi:>, <url:>, <arxiv:>, <issn:>, <isbn:>, <ftp:> - there may be others - apologies I don't know where the official docs are for these.

Here are some examples where they haven't been rendered

Screenshot 2024-06-04 at 19 43 50

Whereas these do render as hyperlinks on CRAN, e.g. https://cran.r-project.org/package=OneSampleMR.

jeroen commented 3 months ago

Thanks for the suggestion! I noticed this as well, but I wasn't sure if it is a good idea to inject html code here.

Also unfortunately R does not expose the code it uses to parse these urls (I think it is done with htmlify_text which is inlined inside tools:::.DESCRIPTION_to_HTML.

Also if I look at the CRAN pages, only the doi: urls are linked? For the examples above the arxiv/isbn/issn urls do not?

remlapmot commented 3 months ago

Oh yes - sorry I didn't check all the CRAN pages.

Also there is an unexported linkify() function in pkgdown which can handle the doi, arxiv, and I think ftp and http (this function seems to produce a bad URL if there is a space after the :).

pkgdown:::linkify("<arXiv:2203.03384>")
#> [1] "&lt;<a href='https://arxiv.org/abs/2203.03384'>arXiv:2203.03384</a>&gt;"
pkgdown:::linkify("<doi:10.1016/j.jeconom.2015.06.004>")
#> [1] "&lt;<a href='https://doi.org/10.1016/j.jeconom.2015.06.004'>doi:10.1016/j.jeconom.2015.06.004</a>&gt;"

Created on 2024-06-05 with reprex v2.1.0

jeroen commented 3 months ago

OK I have implemented it for doi: and arxiv: and https:// links at least. Do you want to check some packages if it seems to work now? I'm not sure yet if it is worth implementing the others (isbn, ftp, etc).

remlapmot commented 3 months ago

Works beautifully - thanks very much.

I agree that those other ones don't seem worth it.