Make self-contained output compatible with Pandoc 2 #1857
Merged
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.
This change makes the minimal changes necessary to make
pandocSelfContainedHtml
work under Pandoc 2, in the case whereinRSTUDIO_PANDOC
has been set to use Pandoc 2. In particular, it adapts to the following breaking changes in Pandoc 2:The
<!DOCTYPE html>
header was treated as HTML and passed through, unmodified, in Pandoc 1. In Pandoc 2, it is treated as Markdown and escaped.In Pandoc 2, the HTML converter warns loudly if no title is present in the metadata.
To address these, respectively:
We now use an HTML template that includes the
DOCTYPE
header. If theDOCTYPE
header is also present in the input HTML, it is removed.We pass a dummy title metadata field into the converter. It is not used in the template, so it isn't present in the output.
These changes are also compatible with Pandoc 1, so RStudio can work with either version.
Fixes #1756.