A tool for creating a document-outline based on HTML5
sections and sub
sections within an
Older documents that use
h6 are not handled.
npm install outliner --save-dev
- Get a handle on the module, e.g.
var uoptoc = require("outliner")
uoptoc.gen(startNode)passing in a DOM node and it will search the descendant tree for all sections and subsections. Each section is given a unique ID if it does not already have one. A nested unordered lists that reflects the structure is returned containing a link to each section.
uoptoc.genPop(startNode, destNode)works as
uoptoc.gen(startNode)except that the resulting UL is appended to the document's
destNodeelement that is passed.
uoptoc.genPop(startNode, destNode)but css selectors for the start and destination nodes are passed.
It uses the JSDOM module, so pass-in JSDOM module objects.
toc ID to generated content
0.1.x The Earth cooled...