Table of Contents collapsable

34 views
Skip to first unread message

Willem Ferguson

unread,
Mar 6, 2020, 1:37:04 AM3/6/20
to asciidoc
We are looking at changing the TOC to be collapsable by changing the CSS/Javascript that is generated by asciidoc. There are a few issues, the most important of which is that the headings are defined in JavaScript as a flat list of items, each with a heading level descriptor. For collapsable lists it is much more simple if the list of headings were organised in a tree structure(s) according to heading levels.

Ideally such changes should be at the level of the asciidoc source code, but we do not have any idea of whether this is important enough for the asciidoc developers. So at the moment we plan to do this as ad hoc changed to the css/js in the asciidoc output. Basically we translate the existing flat list of headings into tree structures and then enable hiding / showing of headings at lower heading levels. The way we do this is by inserting css/js code at the very end of the document, thus not messing with the asciidoc js output. This means that each time we produce a new asciidoc document we have to append our own changes to the end of the document.

The important question is:  do you have  any suggestions about how to organise these changes in a way that is resistant to unrelated changes to the asciidoc source code?
Kind regards,
willem

Reply all
Reply to author
Forward
0 new messages