-
Notifications
You must be signed in to change notification settings - Fork 334
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
Copy-Code button does not appear in articles if there is not at least one H2 and one H3 header #1959
Comments
I can reproduce this. Now if I remove everything that has to do with the table of contents on that page (all the JS i.e. I manually delete the script from the head in |
The problem does not appear with BS3, with BS3 the TOC is added even when there is one h2 only. |
ok thanks Maëlle. Currently I'm just making sure to have a H2 and H3 header as a work around. I'm happy to see that you already have a PR that would fix that. |
@maelle I think the issue is ultimately caused by calling scrollspy (below) when the pkgdown/inst/BS5/assets/pkgdown.js Lines 12 to 15 in 1c2bedc
It seems like, in this case, scrollspy does it's own thing and tries to apply to the The fix might be as easy as avoiding calling scrollspy when the if ($('#toc').length) {
$('body').scrollspy({
target: '#toc',
offset: 56 // headroom height
});
} |
This sounds smart 😃 |
@gadenbuie btw do you want to make a PR? 🙂 (I don't want to steal your fix 😉 ) |
This Rmd will add a copy-code button
This Rmd won't add a copy-code button in articles
This is an odd behavior and I don't think this is expected. Thanks !
Here is my session info.
library(pkgdown)
Created on 2021-12-08 by the reprex package (v2.0.1)
Session info
The text was updated successfully, but these errors were encountered: