Hi,
I'm looking for an editor to document the API of a product we use in a collapsible tree with text and code here and there.
I haven't been able to make that work in Markdown Monster, OneNote or Word.
Does anyone have suggestions? Perhaps a VSCode extension?
TIA,
Alex
Something like this:
+ 1. Product title
+ 1.1 Admin API
Several lines of explanation that collapses when + sign above is clicked
+ 1.1.1 Case 1
* Code sample that collapses when the + sign above is clicked
FOR i = 1 TO 10
IF Condition
DO XXX
ELSE
DO That
ENDIF
ENDFOR
+ 1.1.2 Case 2
More stuff that collapses
+ 2. Sales API
More stuff that collapses when + sign is clicked
etc
What you're asking for is not really a document editing feature but a rendering feature.
You can do this in Markdown Monster by adding a little script to either your page or better your template.
For example doing something like this:
* askdjlaksjdasd
* asdalskdjlaksdjasd
* casdkljasdlk
* asdaskdjhasd
* asdkalskdjasldk
* casdkljasdlk
* asdaskdjhasd
* casdkljasdlk
* asdaskdjhasd
* One More
<style>
li { color: steelblue; }
ul ul>li { display: none; }
</style>
<script src="https://unpkg.com/jquery@3.4.0/dist/jquery.min.js"></script>
<script>
$("li").click(function() {
$(this).find("li").toggle();
});
</script>
will give you collapsible child items:
You can add the script and styles to the bottom of the active template (Right click on the preview and Edit Template) or you can as I did here simply paste the code into the current document. But you do need to make sure you enable script execution in Edit => Allow Script Execution which is nice for testing and playing around with this.
Now this sort of thing doesn't really scale for documentation and I think you REALLY should not do it that way. You're much better off using a table of contents to break things down into small topics and use the TOC to drive your content and sections.
For that sort of thing Help Builder (or KavaDocs) works really well.
+++ Rick ---
Perfect answer Rick. Thank you very much
Alex
Hi Rick,
I haven't found "Allow Script Execution" in "Edit" so haven't been able to expand collapsed items. Can you explain please?
Gladly purchased a license for MarkdownMonster. Good product.
Alex
Ideally though you'll want to add the script code (and possibly the styles) to a custom template. Putting it inline is a bit of work for each topic and it won't render as smoothly as it could.
+++ Rick ---
The MarkdownMonster menu I get does not show AllowScriptInMarkdown.
This is what I get.
That looks like an older version. You probably need to update your version...
In older versions it was on another menu (View perhaps) but you should grab the latest version from the Web site.
https://markdownmonster.west-wind.com/
You may want to uninstall the old version explicitly first - if you had a pretty old version installed, the install locations have changed and perhaps when updating both locations are installed. Easiest is to uninstall completely, then reinstall the new version. Files and settings should preserve across updates.
+++ Rick ---