0.1.7 • Published 10 years ago

outliner v0.1.7

Weekly downloads
29
License
CC-BY-NC-SA-4.0
Repository
github
Last release
10 years ago

Outliner

A tool for creating a document-outline based on HTML5 sections and subsections within an article.

Older documents that use h1-h6 are not handled.

Installation

npm install outliner --save-dev

Usage

  • Get a handle on the module, e.g. var uoptoc = require("outliner")
  • Call 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 destNode element that is passed.
  • genPopSelector works as uoptoc.genPop(startNode, destNode) but css selectors for the start and destination nodes are passed.

Dependencies

It uses the JSDOM module, so pass-in JSDOM module objects.

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago