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

Auto-linking infix operators from in Changelog #1082

Closed
MichaelChirico opened this issue Jul 5, 2019 · 2 comments · Fixed by #1083
Closed

Auto-linking infix operators from in Changelog #1082

MichaelChirico opened this issue Jul 5, 2019 · 2 comments · Fixed by #1083

Comments

@MichaelChirico
Copy link
Contributor

@MichaelChirico MichaelChirico commented Jul 5, 2019

Redirecting from Rdatatable/data.table#3677

pkgdown is good at matching foo() in NEWS to link to ?foo in the reference section, but it appears to miss infix operators like %foo% --> ?`%foo%.

@jayhesselberth
Copy link
Collaborator

@jayhesselberth jayhesselberth commented Jul 5, 2019

I had a look and it's a little tricky because single backticks are used for two purposes in this case: marking code in markdown, and parsing infix operators in R.

So when you write `%in%` in markdown, it gets translated to <code>%in%</code>, which lacks the backticks, which are required for R to parse correctly.

If you use double backticks in markdown (`` ?`%in%` ``), then help for %in% is linked correctly. But a bare function link does not work (`` `%in%` ``) (missing the ?), and it would be annoying to use double backticks everywhere anyway.

I think we'd have to modify the HTML tweaking code to check whether <code>%in%</code> was a backticked infix operator (in the markdown version) and then link it as if it were.

@MichaelChirico
Copy link
Contributor Author

@MichaelChirico MichaelChirico commented Jul 5, 2019

I don't think I follow the pkgdown internals well enough to follow exactly, could you help to point to the code that's driving this?

grepping for <code>%[^%]*%</code> would seem to be pretty straightforward, so there must be a gap in understanding when/how the reference linking is applied

jayhesselberth added a commit that referenced this issue Jul 5, 2019
jayhesselberth added a commit that referenced this issue Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants