parse-ncc
$ npm install parse-ncc
usage
Can be used with any DOM - browser or JavaScript implementation (like jsdom)
var parse = ;var jsdom = ; // Fetch a DOM representing the NCC file, from anywhere you likejsdom;
api
var parse = require('parse-ncc');
parse(Element) -> structure
parse
is a function, taking an Element
. It will return a
hierarchical representation of the flat NCC file. E.g.
IntroductionForewordNoticeCopyrightChapter One
will turn into
heading: children: heading: children: heading: children: heading: children: heading: children:
Each element in the structure
has the following properties:
heading: HTMLElement // The DOM element of the NCC document children: Array // An array of other heading elements - possibly empty