\QuartoMarkdownBase64 command in LaTeX formats #7451
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.
In LaTeX raw blocks and LaTeX output formats,
\QuartoMarkdownBase64{<<base64content>>}
works in LaTeX analogously to how<span data-qmd-base64="<<base64content>>"
works in all quarto formats.Specifically, this allows third-party-libraries that emit LaTeX programmatically to "inject" quarto-compatible markdown in their RawBlocks.
This is necessary for the same reason that the
<span>
trick is necessary. On occasion, a single RawBlock is interpreted (and its contents are parsed) as a full unit. Currently, we parse tables in HTML rawblocks, and do table fixups in LaTeX rawblocks. Both of these require a "single" RawBlock to work.Here's a minimal example:
This renders to:
Notice that both crossrefs and shortcodes are resolved properly.
It might be tempting to think that this feature isn't necessary, and to try something like
The problem is that the matching pair of
\{begin,end}{tabular}
commands are now broken across different RawBlocks, and quarto is then incapable of applying some fixups.We purposefully don't offer a non-base-64 encoded version because parsing the valid non-latex content inside the LaTeX rawblock would be annoyingly hard to do well. We expect this feature to be used by third-party libraries like
gt
essentially all of the time.