Search code examples
markupwiki-markup

Sorted table of contents [TOC] in markup (md)


What is the best practice to list all H1 titles in markup language in sorted list?

If I use [TOC] - order is somehow random. Is there a better way to do it than manually write all links in file?


Solution

  • I am using creole as markup language on BitBucket.

    The syntax there is

    <<toc />> 
    

    which shows all the H1,H2 etc on the pages.

    To sort the pages I am putting 1_,2_,3_,... in front of the page titles (not the H1 but the page title). In this way the page names are also numbered and organised.

    You can also move files inside different directories and then create a table of content for each directory <>