Best way to add custom module docs to Monkey?

Monkey Forums/Monkey Programming/Best way to add custom module docs to Monkey?

Canardian(Posted 2011) [#1]
I don't see any doc generator monkey program in Monkey, so I guess the Monkey docs have to be edited with NotePad++?

And if I want to add new docs for all users, I would need to make some patch program which patches the existing index.html?


matt(Posted 2011) [#2]
Disclaimer: I wrote the monkey docs system. :)

It's possible to add module docs to the system with minimal changes. To add your own docs to the system, we do the following:

1. create a .js file containing json-docs data (search, content, modules/navigation)
2. include this .js file in the main doc .html file, like:
<script type="text/javascript" charset="utf-8" src="json-demo.js"></script>
...and that's it!

You can try it right now by adding the <script> line above to docs/modules/index.html as the test json-demo.js file is included with the monkey module docs.

See here for more information: https://github.com/gingerbeardman/json.docs

The tricky part is creating the JSON data, so it is best done as an automated conversion. So I plan to put together a docs generator of my own, converting from a subset of the Markdown plain text format to the JSON required for the json-docs system.

I am happy to work together with you on this, please send me an email if you are interested.

(Monkey docs are generated from a text file with a custom program that @marksibly wrote. This is pretty bespoke for his use so is not available.)


Canardian(Posted 2011) [#3]
I had a look at the json-docs-content.js file, and it seems I need to make a patch program to patch that, and also json-docs-search.js.
I would prefer to make the patch program with monkey and declare it public domain.
Maybe you could make the main level also expandable, because if you list all modules and their submodules always, the list will become too big soon.


matt(Posted 2011) [#4]
I have made a special effort to make adding to the docs as easy as possible, so please use the suggested method. Patching is much more complicated and involves unnecessary effort and steps.

You don't need to patch json-docs-content.js at all. All you need to do is add your own .js into the index. Have you tried including json-demo.js in the index?

ps: I will eventually look into making the navigation expandable, but this as a separate issue.


Canardian(Posted 2011) [#5]
Ah now I get it, the json-demo.js is a generator demo which adds itself after the official monkey modules in the modules/index.htm.

Ok, that will make it much easier to add MonkeyTools module docs, and then I only need to patch modules/index.htm with one line.


matt(Posted 2011) [#6]
Exactly :)

Recently I have added json-demo.md to github, which shows example source text for the generator I am working on. This will be written in monkey, of course.