I'm not sure Meta is the place for it, since Meta is 'questions about questions'/'questions about the site', but it can be moved if necessary.
Depending on the programming language you're using, you're going to want to take a look at either WEB (original by Knuth, supporting TeX over Pascal), CWEB (Silvio Levy with Knuth, supporting C, C++, and Java), or one of the various other tools available. (I personally recommend
noweb in conjunction with
org-babel—the combination is very easy to work with, and
org supports documentation export to many different formats. LyX also apparently works with
noweb, but I haven't tried it.)
I can only give advice on how to use
org-babel, but the workflow for standalone
web derivatives seems to be the same:
- Acquire a version of
web that you'd like to use, making sure to go through a
Hello, World example.
- Write literate program—comments and code all in one(?) file.
tangle to extract source code and
weave to extract documentation. I imagine this is done using
or the syntax your tool uses. (This can almost always be gotten with