@Edmund — Pandoc doesn’t [yet] support figure/table/equation/theorem cross-references natively. Nevertheless Quarto utilises Pandoc’s existing image attributes extension and uses the #id
tag (see HTML for the origin) to support cross referencing. There are two methods of linking / figure blocks in markdown; inline links:
{#id .class width=30 height=20px}
And reference links, which is the format Scrivener’s compiler generates:
![Caption][ref]
…
[ref]: foo.jpg {#id .class width=30 height=20px}
Scrivener generates it when it converts an embedded-image + caption style into markdown, and it creates this reference at compile time, it doesn’t exist at all in the editor. So the question is, how can the writer in Scrivener add a “unique” #id
in the editor for each paragraph block, which the compiler can use? My solution is simple: the Scrivener user writes the {#id}
at the beginning of the caption block in the editor, this passes through to the markdown untouched:
My post-processing script takes the Scrivener-compiled markdown:
![{#fig-trunk2} Angry elephant with big trunk.][elephant]
[elephant]: elephant.jpg
…and rewrites it to a format Quarto’s cross-referencing system can utilise:
![Angry elephant with big trunk.][elephant]
[elephant]: elephant.jpg {#fig-trunk2}
The other tweak the script does is for maths cross-referencing. Quarto requires the #id
after the maths block without any line break:
$$e^{ix}=r(\cos \theta +i\sin \theta)$$ {#eq-one}
BUT Scrivener’s paragraph style prefix/suffix would put $$
after {#eq-one}
, breaking the equation and cross-ref. So my workaround is to write the label on the next line
and remove the newline between $$
and {#eq-one}
from the markdown file, allowing Quarto to cross-ref properly.