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

Function calls in vignettes could link to the man page #68

Open
vincentarelbundock opened this issue Nov 8, 2023 · 13 comments
Open

Function calls in vignettes could link to the man page #68

vincentarelbundock opened this issue Nov 8, 2023 · 13 comments

Comments

@vincentarelbundock
Copy link
Collaborator

pkgdown does this.

Probably requires some regex magic.

@etiennebacher
Copy link
Owner

Regex is probably going to be very tricky here. You could try downlit:::downlit_md_path() on the vignettes once they are rendered as md (see #27 for small caveats)

@vincentarelbundock
Copy link
Collaborator Author

Actually, I think that if we render the vignettes using Quarto, we get links automatically: https://marginaleffects.com/articles/comparisons.html

@etiennebacher
Copy link
Owner

Oh that's cool

@etiennebacher etiennebacher mentioned this issue Nov 24, 2023
2 tasks
@vincentarelbundock
Copy link
Collaborator Author

What I wrote above is incorrect: Links are not added automatically in quarto. I opened a PR to resolve this:

#273

@zeileis
Copy link
Contributor

zeileis commented Jul 4, 2024

The PR was merged but this issue is still open. I think this is because it still does not work everywhere, does it? (At least it does not for me, even with autolink = TRUE.)

Relatedly, it would be good to hyperlink the topics in the "See Also" sections of the manual pages. References to functions in the same package could be hyperlinked within the altdoc site. References to other packages could resolve to rdrr.io (which pkgdown uses as well).

@vincentarelbundock
Copy link
Collaborator Author

So I realized after doing a bunch of work that Quarto can autolink by adding a line to the preamble.

Leaving this open for now because I need to remove the cruft from that merged PR.

Good call on the See Also. I'll look into it when I find time (probably after UseR!)

@vincentarelbundock
Copy link
Collaborator Author

@zeileis I think you might be able to get function links everywhere by adding this to the bottom of your altdoc/quarto_website.yml:

format:
  html:
    code-link: true

Your betareg website looks fantastic, BTW!

@zeileis
Copy link
Contributor

zeileis commented Jul 6, 2024

Hmm, the code-link setting does not seem to have an effect on the "See Also" sections. The README is linked but only to rdrr.io and not to the man-pages in the altdoc page itself. The NEWS are also not linked. But maybe I forgot to set something correctly.

And, yes, I like the look of the betareg page, too. But it is altdoc/quarto which makes this easy. I didn't have to do a lot to get something really nice.

@vincentarelbundock
Copy link
Collaborator Author

Thanks. Reopening, and will check later.

@vincentarelbundock
Copy link
Collaborator Author

@zeileis I'm not sure this is going to fix the "See Also" problem, but I think the lack of internal links is likely due to the absence of a pkgdown.yml file in the root directory of your live website. For example:

http://marginaleffects.com/pkgdown.yml

Has this content:

urls:
  reference: https://marginaleffects.com/man
  article: https://marginaleffects.com/vignettes

Note that this YAML file must be live on the internet when downlit is called. So you probably need to upload it to your server, and then rebuild the site.

@zeileis
Copy link
Contributor

zeileis commented Jul 8, 2024

Thanks, Vincent, I just told you in person but just to keep Etienne in the loop as well: Putting pkgdown.yml into the root directory improved the situation but did not resolve everything. In some places (e.g., README, manual pages and vignettes) function names are hyperlinked, wenn they are followed by opening round brackets. But without round brackets (e.g., in "See Also") or in some other places (e.g., NEWS) I didn't get it to work yet...

@vincentarelbundock
Copy link
Collaborator Author

The lack of links in NEWS is a problem, but I think the parenthesis requirement for links is a design choice by downlit. Here's what their README says:

Screenshot 2024-07-09 at 12 01 43 AM

@zeileis
Copy link
Contributor

zeileis commented Jul 8, 2024

OK, thanks. Not sure what pkgdown then does differently for the "See Also" sections. This also recognizes fun without further formatting.

As for the NEWS, I thought that it might be a .md vs. .qmd issue but the result was the same no matter which suffix I used (unless I overlooked something).

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

Successfully merging a pull request may close this issue.

3 participants