Draft: Catala command to create a pandoc markdown#1024
Conversation
|
Awesome! Once this is mature enough we can backport the |
denismerigoux
left a comment
There was a problem hiding this comment.
Thank you!! I guess now we' could lift these commands to clerk so that we can produce a .md or .tex or .html file per target ;)
|
|
||
| let rec fmt_toc | ||
| (parents_headings : string list) | ||
| fmt |
There was a problem hiding this comment.
So here's a long-standing Markdown feature we currently do not support: whatv about really long titles that need to be split into multiple lines like:
## Such a very long title we need
## two lines to write itRight now Catala parses it as two different titles of the same level. I don't think it's in the scope of this PR to support this but this gives you an idea of where we would want to go in terms of functionnalities. The pain point to support this feature for instance is that heading parsing currently goes through the Catala parser, so we would need to tweak the Catala parser just for that small feature of Markdown, while we ignore in the Catala parser most of the other Markdown features (because we delegate them to Pandoc later).
| and social benefits computation rules. Copyright (C) 2020 Inria, contributor: | ||
| Denis Merigoux <denis.merigoux@inria.fr> |
There was a problem hiding this comment.
You can change the name and date here for something more accurate like :
Copyright (C) 2026 Inria, contributor: Arnaud Bihan <XXXXX>
| $ Cli.Flags.wrap_weaved_output | ||
| $ Cli.Flags.extra_files) | ||
|
|
||
| let pdf options output print_only_law wrap_weaved_output = |
There was a problem hiding this comment.
This is very nice but the PDF generated by Pandoc is very ugly no? Right now our pipeline of choice to generate PDF is through LaTeX with the preamble set out in
https://github.com/CatalaLang/catala/blob/master/compiler/literate/latex.ml#L52-L165
I would prefer not to roll out an out-of-the-box PDF feature that provides an uglier PDF than the one we're already providing with our current preferred pipeline.
There was a problem hiding this comment.
Yes you're right as of right now the feature is far from being completed. That command was just to give an example of what was possible and also to test the pdf result with a single command instead of two (generating the pandoc markdown and then call pandoc targetting pdf)
There was a problem hiding this comment.
Mmmh after checking I may have introduced something wrong in the last version because indeed the pdf is not working as expected, it was working way better before now there are a lot of {...} that should not appear
There was a problem hiding this comment.
Amazing, did not know pandoc supported that,!!
|
While your added syntax highlighting is pretty neat, I am a bit wary of having yet another syntax coloring spec in yet another format (I am losing count of how many we have :/) An option could be to try and leverage the fancy highlighting based on the tree-sitter syntax that we already use for the catala-book. One possible way to do this would be to preprocess all catala code blocks with something like
|
e2562d4 to
d946a54
Compare
A new catala command to create a pandoc-markdown, from that pandoc markdown you can use pandoc to generate any kind of file pandoc supports. To give an example I've also created a backend to generate a pdf . Markdown html and pdf files are generated but there are still some issues (for example pdf links are not working properly while html and markdown are working fine)