Fenced graph blocks (e.g. DOT graph, etc.)
Omikhleia opened this issue · 2 comments
Some Markdown converters recognize fenced code blocks of a certain type (infostring/class) as graph drawing language and renders them visually.
For the record, my previous experiment with a Pandoc custom Lua writer did that too, but only when certain attributes are set:
All the above examples (= of fenced code blocks) specified the programming language after the fenced
code block marker (e.g. lua ). For the DOT graph language, this converter also supports an extended syntax{.dot width=... height=...}
. When a width and/or a height are specified, the graph is included as an image, instead of the corresponding code.
Things to address
- Prerequisite We'd need good packages for invoking the appropriate program and retrieving the image (my old quick'n dirty experiment for
dot
is certainly subpar). - So as to render the fenced block as an image rather than text, we'd need some appropriate way for the markdown package to know which supporting packages are available for a given format (e.g. possibly checking loaded converters, but the SILE converters is IMHO a wrong mess...)
- Proper Markdown syntax. In the above case I suggested using width/height because:
- It's very likely the user needs to control these depending on his favored page layout/style.
- There must be a way to still get the code rendered as text if wanted.
In the same vein, also considering Lilypond-in-Markdown...
Some links for mere reference
- (some sort of syntax extension for Hugo) https://lilypond-in-markdown.netlify.app/ (https://pianomanfrazier.com/post/lilypond-in-markdown/)
- (Pandoc filter) https://github.com/jgm/pandocfilters/blob/master/examples/lilypond.py
- (something for Jekyll) https://github.com/leahvelleman/jekyll-lilypond
- (something for Sphinx - didn't check but FWIR, reStructuredText rather than Markdown) https://github.com/sphinx-contrib/lilypond
- (SILE's own topics, uncompleted) sile-typesetter/sile#435, sile-typesetter/sile#435, [lilypond.sile](https://github.com/sile-typesetter/lilypond.sile ...
Prerequisite We'd need good packages for invoking the appropriate program and retrieving the image (my old quick'n dirty experiment for dot is certainly subpar).
There we go: https://github.com/Omikhleia/embedders.sile = DOT, Lilypond.