In the few Nimib files that I created, I always resort to templates similar to this one for the creation of a table of contents (TOC):
var nbToc: NbBlock
template addToc =
newNbBlock("nbText", false, nb, nbToc, ""):
nbToc.output = "### Table of Contents:\n\n"
template nbSection(name:string) =
let anchorName = name.toLower.replace(" ", "-")
nbText "<a name = \"" & anchorName & "\"></a>\n## " & name & "\n\n---"
# see below, but any number works for a numbered list
nbToc.output.add "1. <a href=\"#" & anchorName & "\">" & name & "</a>\n"
It would be interesting to make this easily configurable with a simple addToc command, that would define nbSection, nbSubSection, nbSubSubSection, nbParagraph (like Latex?) or nbH1Title, nbH2Title, etc ... for each level of heading.
It would be cool if the Toc appearance could be configurable too (level of heading, title?) without having to resort to nbToc.output and newNbBlock.
In the few Nimib files that I created, I always resort to templates similar to this one for the creation of a table of contents (TOC):
It would be interesting to make this easily configurable with a simple addToc command, that would define nbSection, nbSubSection, nbSubSubSection, nbParagraph (like Latex?) or nbH1Title, nbH2Title, etc ... for each level of heading. It would be cool if the Toc appearance could be configurable too (level of heading, title?) without having to resort to nbToc.output and newNbBlock.