-
Hello, I would like to implement live preview for a custom syntax (very similar to djot) in a C (GTK) program.
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
re 1. Easiest approach would be to run re 2. The Haskell parser does not run in IO, so the parser can't directly include a file. However, you could use a later transformation stage on the AST, matching an AST element and replacing it with the result of parsing another file. In pandoc the RST reader, for example, implements inclusion. re 4. Pandoc is not particularly fast, so I don't think it would be good for that purpose. The Haskell djot parser is probably fast enough (used by itself -- pandoc brings in other things that slow down conversion). Even faster is the Rust djot parser. |
Beta Was this translation helpful? Give feedback.
re 1. Easiest approach would be to run
pandoc server
in a separate process and pass JSON back and forth. In principle it should be possible to use Haskell's FFI to expose a C library, but this would take some work.re 2. The Haskell parser does not run in IO, so the parser can't directly include a file. However, you could use a later transformation stage on the AST, matching an AST element and replacing it with the result of parsing another file. In pandoc the RST reader, for example, implements inclusion.
re 4. Pandoc is not particularly fast, so I don't think it would be good for that purpose. The Haskell djot parser is probably fast enough (used by itself -- pandoc brings in other thin…