polymode/poly-noweb

HTML hostmode for documentation chunks

smartmic opened this issue · 2 comments

Is it also planned to have a HTML hostmode for the documentation chunks in noweb?

I know the standard is Latex but for me HTML is more approachable. Polymode is very new to me, but what I have seen so far it should be quite flexible to allow for other hostmodes.

HTML as host mode should work well. HTML innermodes are problematic. What is the use-case? I haven't heard of html noweb. Do you have an example? Is it common enough to be supported as part of the package? You can try creating your own html-noweb mode by replacing latex with html here

I just discovered noweb and learned from the noweave manual that "noweave can work with LaTeX, plain TeX, troff or HTML."

My use case: As a newbie noweb user I want to see quick results in order to decide if literate programming is something to spend more time on. For non-print grade documentation, HTML is fine, in fact I like it better than markdown (I think anyhow markdown is overrated, but this is a different story). So just for trying out and creating some HTML documentation of my literate programming exercises, simple HTML should be fine as my LaTeX skills are already a little bit rusty.

Your hint about changing the host mode within the code given is already valuable, I will it try out! But I fear html noweb it is not very common though. On the other hand, my impression is that noweb is not so common at all nowadays.

And here is a very simple example for html noweb, just run noweave -html -index simple.nw > simple.html to get the resulting HTML page. Except for the missing <!doctype html> (which could be added to the noweb source together with boilerplate and giving the -delay option to noweave), this is perfectly valid HTML.

In my case, I added syntax highlighting with highlight.js and also plan to add MathJax for typesetting equations later. Both is possible by adding the script snippets directly into the noweb file (not showing here for brevity).

<p>A paragraph

  <ul>
    <li>First item
    <li>Second item
  </ul>

<p>Another paragraph

<<hello.c>>=
/*
   <<license>>
*/
#include <stdio.h>

int main(int argc, char *argv[]) {
   printf("Hello World!\n");
   return 0;
}
@

<p>it goes on…
  
<<hello.php>>= 
<?php
  /*
 <<license>>
  */
  echo "Hello world!\n";
?>
@

<p>This is put into the public domain
    
<<license>>=
CC0