Hacker News new | ask | show | jobs
by rus20376 951 days ago
CWEB spawned several other Literate Programming systems, the main differences being in programming languages supported as well as how the documentation was formatted.

My favorite is nuweb https://nuweb.sourceforge.net/ which allows for LP in virtually any language and provides documentation in LaTeX. The main trade off being that with wide language support the code sections are as-is, without special formatting. Since mostly people write the code sections to their own tastes already this is not a significant problem.

1 comments

I use Noweb <https://www.cs.tufts.edu/~nr/noweb/>, which is, I believe, very much like nuweb. It is also LaTeX-centric, and also allows code sections to be written in any language. Within code sections, instead of depending on Noweb for code formatting, I use a syntax-aware editor. I configure Vim to recognize the language within each code section. This means that, in Vim, I get formatting and syntax highlighting.

Vim is also able to export syntax highlighted code as HTML markup. Because Noweb is modular and supports plugin filter stages, it might be possible to write a Noweb filter stage that calls Vim, translates the markup to LaTeX, and adds syntax highlighting to the document. This is something I haven't tried.