[NTG-context] Set up external figure for particular image type
albert+context at zeitkraut.de
Wed Jul 13 00:33:22 CEST 2022
Thangalin via ntg-context <ntg-context at ntg.nl> writes:
> The source comes from Markdown, which is converted to XML, then typeset
> using ConTeXt. There's no Markdown-specific mechanism to relate images
> to a particular external figure definition, unfortunately. All images
> use the same syntax and are treated the same way. The only part that
> differs is the file name extension (and header within the file).
The below is likely overkill and a good bit of work to setup, but it is
also very flexible. Maybe it suits your needs.
The Markdown-to-XML conversion can be tuned to include all the relevant
information. E.g., you could use pandoc with a custom writer to produce
the XML format of your choice. The link below is an example XML writer
that can be tuned as needed.
With that setup, one can modify the `Image` function to produce the
output you need. E.g., match on the file name extension use the library
function `pandoc.path.split_extension` and then change the element type
depending on the extension.
This way you'd have all the important information in your XML.
More info: <https://pandoc.org/custom-writers> and
Of course, you could also use pandoc to go directly to ConTeXt; that is
currently my preferred way of producing PDF from Markdown.
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
More information about the ntg-context