3 ms·
My flow is to go through the Pandoc JSON AST and then use Jq. This works for other input formats, too.
by unglaublich 2y ago
My flow is to go through the Pandoc JSON AST and then use Jq. This works for other input formats, too.
- yshavit 2y agoI'm curious how ergonomic you find that? I did look at the pandoc JSON initially, and found it fairly awkward to work with. It's a great interchange format, but doesn't seem optimized for either human interaction or scripting. (It's definitely possible to use it for scripting, it just felt cumbersome to me, personally.)
- saghm 2y agoI've never had a need for parsing markdown like this, bit I have to wonder, would it make to go through HTML instead, given that it's what markdown is designed to compile to? At that point, I'd assume there's any number of existing XML tools that work work, and my (maybe naive) assumption is that typical markdown documents would be relatively flat compared to how deeply nested "native" HTML/XML often gets, so it doesn't seem like most queries would require particularly complex XPath to be able to specify.
- MathMonkeyMan 2y agoI did this for a tool that checks relative links in markdown files, e.g. readmes in a repo. markdown -> xhtml -> sxml -> logic (racket)