Ancestors

Toot

Written by Matthias Endler on 2025-01-06 at 21:30

Is there a tool like jq, but for extracting parts of a Markdown document based on a query language?

[#]cli #jq

=> View attached media

=> More informations about this toot | More toots from mre@mastodon.social

Descendants

Written by Paul Young on 2025-01-06 at 21:44

@mre you could use something like m2j to convert it to JSON first

=> More informations about this toot | More toots from paulyoung@mastodon.social

Written by Matthias Endler on 2025-01-06 at 21:49

@paulyoung uuh, interesting! Does it preserve stuff like links and headings?

=> More informations about this toot | More toots from mre@mastodon.social

Written by Paul Young on 2025-01-07 at 03:18

@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

Written by Matthias Endler on 2025-01-07 at 08:47

@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

Written by Wesley Moore on 2025-01-06 at 22:53

@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

Written by Matthias Endler on 2025-01-06 at 23:03

@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

Written by trójkąt ▼ on 2025-01-06 at 23:03

@mre check this thing https://github.com/yshavit/mdq

=> More informations about this toot | More toots from trojkat@101010.pl

Written by Matthias Endler on 2025-01-06 at 23:04

@trojkat wow, that's actually exactly what I was looking for! Nice find. ✨

=> More informations about this toot | More toots from mre@mastodon.social

Written by Wesley Moore on 2025-01-06 at 23:11

@mre @trojkat nice! it's even implemented in Rust :)

=> More informations about this toot | More toots from wezm@mastodon.decentralised.social

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113783540698233489
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
482.768662 milliseconds
Gemini-to-HTML Time
1.551658 milliseconds

This content has been proxied by September (3851b).