Diverts records (text lines) to either SGML declaration parsing, SGML content parsing, or markdown parsing, based on configuration and on the record's position and content.


new Diverter(sgmldecl, errorhandler, locator, resolver, tokenizer, markdown, doc, entitydefinitions, recordmanager, suppressdocumentelementfilter, markdownoutputfilter)


Name Type Description
sgmldecl Sgmldecl
errorhandler Errorhandler
locator Locator
resolver SystemSpecificEntityResolver
tokenizer Tokenizer
markdown Markdown
doc Markupdefinitions
entitydefinitions Entitydefinitions
recordmanager Recordmanager
suppressdocumentelementfilter SuppressDocumentElementFilter
markdownoutputfilter MarkdownOutputFilter

Name Description
markdown_disabled Flag to force-disable diverting to markdown from outside.
stream Stream object (XHR or Node.

Name Description
handle_record Called on each input line.
reset Resets internal state.

Member Details


Called on each input line.

Aggregates SGML declarations starting on the first sent line into an internal buffer until complete, then invokes SGML declaration (or declaration reference) parsing. Other lines are forwarded to either markdown or straight into markup parsing.


Name Type Description
line string

the input line text without newline

markdown_disabled :string

Flag to force-disable diverting to markdown from outside.

Used in templating subcontexts where we don't want html wrapper tags. Must be set prior to markdown_enabled assessment


Resets internal state.


Stream object (XHR or Node.js fsReadStream) used for fetching markdown entities.