corollari / caoutchouc

Make TeX great again
https://caoutchouc.io
MIT License
43 stars 1 forks source link

Maybe add a Tex generator backend ? #3

Open SheatNoisette opened 5 years ago

SheatNoisette commented 5 years ago

Caoutchouc rely mostly on string replacing and giving the string replaced document to Pandoc. I know it's a bit "too much", but why not create a parser which generate Tex code ready to be processed by pdflatex or other ?

This would remove Pandoc as a required package and so improving portability. Moreover, this might enable Caoutchouc to run on modern browser with something like LatexJS.

corollari commented 5 years ago

I agree, the end-goal of caoutchouc is to become an standalone parser, which would also allow the improvement of many parts of it. Right now, using pandoc gives us the boon of bug-free mature software but eventually it'll have to be replaced.

I've previously attempted a basic implementation using regexes, which I abandoned because of the many edge-cases I wasn't able to fix. I've also been toying with the idea of forking pandoc, but right now I don't have the time available to learn Haskell.

Would you be interested in building it?

SheatNoisette commented 5 years ago

Maybe writing a custom parser with Haxe and/or JS should be a better idea. This should give more control over the output and the syntax of Caoutchouc. I don't know any JS-based Markdown parser which gives access to his own internal parser tokens easily.

I lack a lot of free time atm. I don't know if I can put some effort in making an AST based Markdown parser specifically for the project.

corollari commented 5 years ago

JS-based Markdown parser which gives access to his own internal parser tokens

Here's some ideas:

In my opinion going with something like ANTLR would give us the most flexibility. That would free us from writing the parser but we would still need to deal with everything else.

SheatNoisette commented 5 years ago

ANTLR4 might be useful for generating the parser, but we need to do some glue code to make this working. However, MarkedJS needs some work to support and €€ tags.