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

Don't add anchors to empty headings #1938

Merged
merged 5 commits into from Oct 28, 2020

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Oct 28, 2020

Edit: sorry the PR was submitted accidentally before I could add the description.

This PR fixes #1937 by ensuring that anchors are not added to empty headings.

I also added a CSS rule that hides anchor sections if they end up being a direct child of a list item. This happens on the rare occasion where the HTML is rewritten by another script after anchor sections are added. See rstudio/learnr#446 for such an example.

Finally, I bumped anchor sections to 1.0.1 in html_dependency_anchor_sections().

All of the above were committed individually so you can cherry pick as needed.

@CLAassistant
Copy link

CLAassistant commented Oct 28, 2020

CLA assistant check
All committers have signed the CLA.

@gadenbuie gadenbuie changed the title Don Don't add anchors to empty headings Oct 28, 2020
@gadenbuie gadenbuie marked this pull request as ready for review October 28, 2020 13:12
@cderv
Copy link
Collaborator

cderv commented Oct 28, 2020

Thanks ! LGTM

@cderv cderv merged commit 2787b50 into rstudio:master Oct 28, 2020
@cderv
Copy link
Collaborator

cderv commented Oct 28, 2020

@gadenbuie I bumped the version so that you could easily depend on rmarkdown 2.5.3

cderv added a commit that referenced this pull request Dec 7, 2020
fix which has been done in JS in #1938
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should anchors be added to empty headings?
3 participants