jmalarcon / MIIS

Powerful file-based CMS for IIS - Your Markdown-based documentation or website in a few minutes!
https://miis.azurewebsites.net/
MIT License
31 stars 6 forks source link

Theme Material TOC Hide sub sub-levels #10

Closed DanielSjogren closed 6 years ago

DanielSjogren commented 6 years ago

With the theme Material, sublevels are hidden by default in the TOC. But when entering the level, all sublevels are shown.

Is it possible to extend so the TOC has support for more levels than two?

jmalarcon commented 6 years ago

Hi Daniel:

Currently it works that way: showing the full tree when you access any sublevel. However it's easy to change this behavior by tweaking a little bit the jQuery in the Templates/common.js file, line 30:

currLink.parentsUntil('.miis-toc > ul').last().find('li').show();

Remove that line and you can change the behavior to do exactly what you want (I guess showing only the current levels needed to show your current link.

I've not tried it but I guess that you could simply hide all the sublevels one by one instead of only the second-level ones, changing line 28 to:

}).parent().find('li').hide();

and then changing line 30 to this one:

currLink.parentsUntil('.miis-toc > ul').find('li').show();

Try to tweak the jQuery a little bit with something similar to this and it should be quick to change.

HTH