Document how custom formats work / enable Pandoc templates #5134
Replies: 2 comments 6 replies
-
It appears the issue with MathJax embedding went away, see jgm/pandoc#8362 (comment). I still wish Quarto would do less intransparent things, to make it easier for Pandoc users to adapt it to one's needs. |
Beta Was this translation helpful? Give feedback.
-
I did some further reverse engineering, based on what happens with Quarto calls its internal copy of Pandoc with the arguments
where The defaults file The files On the other hand, The main template, I assume there is a reason for this complexity, but it makes it extremely complicated to use one's own template. What I'm trying to achieve is to create a custom format which supports all features of Quarto, or at least a large selection of those I might eventually use, but which is as lean as possible: No unnecessary JavaScript, no duplicate or mutually overriding CSS styles. |
Beta Was this translation helpful? Give feedback.
-
As explained previously in #4889 (comment), I'm trying to translate my long-used Pandoc formats to Quarto. During my first attempt to do so, I stumbled upon what might be considered a bug in
quarto create extension
, but as pointed out in a helpful dev's comment, it can be easily worked around if one knows more about how custom formats work internally.Now I ran into another issue: Apparently,
embed-resources
is incompatible with MathJax. The workaround provided there involves customizing the Pandoc template for HTML documents. In Pandoc, doing so is relatively easy: One uses--print-default-template=html
, saves the output to a file, edits it, and provides it throughtemplate:
.Specifying a template is also possible in Quarto, but there seems to be no way of getting the default template. I did some reverse engineering, and discovered that before calling Pandoc, a file
template.patched
is created, which includes several (also created) sub-templates, and also this part:So, would it work if I copied this
template.patched
file, and made the additionscript.data-external = "1";
? Or is the template truly "patched", i.e. dynamically generated?What I ended up doing is adding this code to my custom format:
But this is a hack, and it would be so much easier if Quarto would provide a default template.
Speaking more generally: The power of Pandoc comes not only from the many output formats it supports and its many options, but just as much from its template engine. Quarto adds to this power by enabling computationally created content, but in its current form it takes away the easy templating.
Please document the way custom formats work internally, and in particular preserve Pandoc's awesome templating.
Beta Was this translation helpful? Give feedback.
All reactions