Add an option to opt-out using header-attrs HTML dependency in html_document_base()
#2227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we use a JS script in a custom
html_dependency_header_attrs()
so that we can "fix" breaking pandoc behavior from change in 2.8. We do that when Pandoc 2.9+ is used.With rmarkdown we currently use pandoc's
--section-div
flag by default. This will create a<div>
to encapsulate header. When attributes are added on header, they are moved to this section div. Behavior changed in Pandoc 2.8Text to convert using
pandoc --to html4 --section-div
# hello {.anchor #id attr='val'}
With Pandoc 2.7.3 - nothing added on header itself - all move to section div
With Pandoc 2.8 - breaking change - class is not moved anymore
With Pandoc 2.9 to 2.13 - only id is moved now.
The change of Pandoc regarding class was breaking some tools (#1723, #1732) and so it was added a JS script to remove the class on header.
This could no be desired always like rstudio/bookdown#865 and r-lib/pkgdown#1538.
So this PR adds an option to opt-out including the HTML dependency. This would solve the two issue above IMO