Hi devs,
Back in 2014 I had implemented an autotoc
rendering transformation to automatically add a {{toc/}}
macro at the top of wiki pages. See Loading... and XRENDERING-345: Add an Auto TOC transformation to automatically add a… · xwiki/xwiki-rendering@a5bf220 · GitHub
We have several options:
- make it a contrib extension
- bundle it in xwiki-rendering, as we do for the wikiword, linkchecker and icon transformations
- consider it’s not a good idea and drop it.
3.1 Provide a TOC panel, see Loading... (which isn’t implemented FTM).
3.2 Provide another mechanism, like an “after title” UIX to display it and which could be folded/unfolded, possibly with a cookie to remember the folding state.
3.3 Provide sections as an addition tree node level in the Document Tree macro and thus in the Navigation Panel.
Since this is a FAQ (having an auto toc), my preference would be to add a solution for it in XWiki by default (i.e. not 1)).
Re 1) and 2), I also think that we need some config mechanism so that it’s only executed in some page hierarchies, as otherwise it would get executed for all pages, leading to possibly sub-optimal results on some pages. We could imagine some xwiki.properties
configuration using regexes (similar to the renderingcache).
Re 1) and 2), we might also need a config option in xwiki.properties
to decide if the added toc is floating or not.
So WDYT about the different options?
My preference:
- Immediately, I’d go for 2) since it’s mostly ready and since it’d be off by default, it cannot harm much.
- For the further future, I’m not sure, 3.1 is nice but it takes a lot of visual space (too much IMO) and forces to have panels displayed. 3.2, if done right, feels interesting. 3.3 seems appealing too.
Thanks
-Vincent