Output the AST as JSON #310
Replies: 1 comment 1 reply
-
Hi there! There are two main options that present themselves. This isn't currently (directly) possible using just the binary itself. The closest thing it has to "output a raw AST" is the XML output mode — which is actually pretty damn close! You could post-process the XML into JSON and you're likely to have the fidelity you want. If you want more control than that, or if the XML output as it stands is missing some pieces you need from the AST nodes, you'd need to write something yourself that uses Comrak as a library to parse the input, and then output the JSON you want directly. There's a (very general) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I would like to take a markdown file, generate the AST and then output the AST as JSON object/file so that I can then perform a further action on it. I am still exploring the options, but is it possible to just extract the AST without parsing it into a different format?
Beta Was this translation helpful? Give feedback.
All reactions