Is there a tool like jq
, but for extracting parts of a Markdown document based on a query language?
[#]cli #jq
=> More informations about this toot | More toots from mre@mastodon.social
@mre you could use something like m2j to convert it to JSON first
=> More informations about this toot | More toots from paulyoung@mastodon.social
@paulyoung uuh, interesting! Does it preserve stuff like links and headings?
=> More informations about this toot | More toots from mre@mastodon.social
@mre apparently I was mistaken. m2j appears to only work on front matter. You could probably convert it to HTML instead and then use some other tools.
=> More informations about this toot | More toots from paulyoung@mastodon.social
@paulyoung Fair enough. mdq is probably the way to go. See the other thread. 😉
=> More informations about this toot | More toots from mre@mastodon.social
@mre treesitter has a standard query language (https://tree-sitter.github.io/tree-sitter/using-parsers/queries/1-syntax.html) so it might be possible with https://github.com/tree-sitter-grammars/tree-sitter-markdown
=> More informations about this toot | More toots from wezm@mastodon.decentralised.social
@wezm cool idea. Wonder how hard it would be to build a CLI wrapper around it. Maybe someone is looking for a fun Rust project... 😉
=> More informations about this toot | More toots from mre@mastodon.social
@mre check this thing https://github.com/yshavit/mdq
=> More informations about this toot | More toots from trojkat@101010.pl
@trojkat wow, that's actually exactly what I was looking for! Nice find. ✨
=> More informations about this toot | More toots from mre@mastodon.social
@mre @trojkat nice! it's even implemented in Rust :)
=> More informations about this toot | More toots from wezm@mastodon.decentralised.social This content has been proxied by September (3851b).Proxy Information
text/gemini