-- F.
This turns out to be very simple to set up:
http://fnd.lewcid.org/tmp/Code_Illuminated/
After checking out the source, all I had to do was create a JavaScript
file[1] and add the "sample" link for it to index.html.
The only concern right now is the use of WikiCreole; we wouldn't wanna
use a different wiki syntax for the code documentation.
I assume making TiddlyWiki's formatters work with this would take quite
a lot of effort - so perhaps we could just tweak the existing Creole
parser[2] to support TiddlyWiki idiosyncrasies?
-- F.
[1] http://fnd.lewcid.org/tmp/Code_Illuminated/docs/foo.js
[2] http://code-illuminated.googlecode.com/svn/trunk/scripts/wikicreole.js
That's great - thanks!
I've updated the sample accordingly:
http://fnd.lewcid.org/tmp/Code_Illuminated/docs/foo.js
http://fnd.lewcid.org/tmp/Code_Illuminated/#docs/foo.js
> I think the script looks for the WikiCreole-style heading/bolding
Yep - was easy to fix though:
} else if (text.charAt(0) == "=" || text.charAt(0) == "*") {
vs.
} else if (text.charAt(0) == "!" || text.charAt(0) == "*") {
(that's on l. 104 of docs/docs.js)
-- F.
I absolutely agree.
Question is, what should that minimal subset be, and which patterns do
we need.
The most important part, of course, are function signatures.
Since JSDoc* is the traditional choice here, let's see what that would
look like:
/**
* <summary>
*
* @param {<type>} <name> <description>
* @returns {<type>} <description>
*
* <details>
*/
function foo( ... ) { ... }
While this often isn't very readable (esp. WRT distinguishing argument
names and descriptions), the basic structure - flag plus slots for type,
name and description - is useful.
So here's what I imagine we might end up with:
//# !foo
// <summary>
//#
//# * param <name> (<type>): <description>
//# * returns (<type>): <description>
//#
//# <details>
function foo( ... ) { ... }
(Note: Using individual "//" and "//#" markers instead of "/* ... */"
because that's what Cook understands.)
As for supported markup, I think headings, lists, italics, monospace and
links would probably suffice for starters.
(Note that internal links don't seem to be supported yet.)
We should agree on these basics ASAP so we can start on the actual
documentation.
-- F.
> I favour forsaking the template altogether and writing a brief
> description of the function, with a note describing anything unusual.
+1 I think the params stuff is unnecessary duplication - It's more
interesting to document what the function does, than force people into
duplication of the function signature, which will no doubt soon go
stale.
Paul (psd)
--
http://blog.whatfettle.com
I fully agree.
This is something I've often struggled with - a good function signature
usually makes parameter documentation redundant - and I think your
conclusion is very reasonable.
(FWIW, I think that the reference to autoSaveChanges is actually
important in this example.)
So we should now be able to Just Do It.
Perhaps I'll look into extending the parser with basic support for
internal links, as that might be handy (e.g. in the case of saveTiddler
referencing autoSaveChanges).
-- F.