-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding "AST in JSON" output fromat #58
Comments
That's a good idea, and I don't think this would be too difficult. However, I'm reluctant to make this library depend on a json library -- right now it has no dependencies. One option would be an optional module that consumes the output of |
Yeah, I don't think a library is required to emit json, we can just push stuff to string, the same what we do for HTML (I think?) Very much appreciate the zero-dependency nature of the reference impl! |
I think this is mostly done now, via |
I've added this to the live sandbox, too |
Problem: I'd love to experiment with djot, but I don't know lua, and would rather use a language I am already familiar with (Rust or TypeScript).
Proposed solution: add
djot -a -j
to output AST in some JSON format which then could be easily consumed by other programs.I think I probably can get something like this via
pandoc
, but I'd rather avoid adding one more tool to the pipeline.Yeah, the appropriate pandoc spell is
pandoc -f djot-reader.lua -t json example.djot
. There's another drawback with that approach: today's pandocjson
output is a rather low-level encoding of Haskell data structures, it's not something you can justJSON.parse
in javascript and get a natural API. I think there's some benefit to defining a more first-class JSON AST encoding for djot.The text was updated successfully, but these errors were encountered: