←back to thread

140 points Tomte | 6 comments | | HN request time: 2.145s | source | bottom
1. fjfaase ◴[] No.26288320[source]
I am working on a tool, which can take a collection of MarkDown files with fragments of C code, and can combine these into a single C file, where all fragments are placed in an order, such that they can be compiled. Because defines can change the meaning of code depending where you place them, there are some restrictions on the input files. An example of the type of input file I have in mind, is given at https://github.com/FransFaase/RawParser/blob/master/docs/gra... . The tool I am developing, and which is far from finished, can be found in https://github.com/FransFaase/IParse in the MarkDownC.cpp file.
replies(2): >>26288829 #>>26290610 #
2. qbasic_forever ◴[] No.26288829[source]
Check out lit.sh, it's a super simple shell script that does what you're after: https://github.com/vijithassar/lit It's basically a one way markdown to commented source converter. One really slick thing is that since it just comments out the markdown you lose no information about line numbers and can interpret errors from your compiler, etc. with ease (something which is almost impossible with more complex literate programming systems like noweb).
replies(1): >>26293612 #
3. nerdponx ◴[] No.26290610[source]
This sounds a lot like the R Markdown format. https://rmarkdown.rstudio.com/articles_intro.html
replies(1): >>26293636 #
4. fjfaase ◴[] No.26293612[source]
I would like to do a little more than this, as this script would still require you to enter the code fragments in an order in which they can be compiled. I also would like to use ellipses ('...') to allow to extend the definition of types and initialization functions. One of the ideas of LP is that you can present your code fragments in a non-linear fashion, explaining the code from inside-out and/or to delay the implementation details till the end. The problem with keeping the lines in sync, can also achieved by adding #line statements in the generated code.
5. fjfaase ◴[] No.26293636[source]
I understand that R Markdown format is not similar to the GitHub MarkDown format. (Correct me if I am mistaken.) I would like to use the basis format of GitHub, also because it compatible with the github.io documentation websites.
replies(1): >>26293923 #
6. nerdponx ◴[] No.26293923{3}[source]
I believe it's mostly compatible with Github Markdown and CommonMark. I'm not sure if the code blocks will render properly on Github.