Skip to content

Latest commit

 

History

History
73 lines (63 loc) · 2.07 KB

README.adoc

File metadata and controls

73 lines (63 loc) · 2.07 KB

textlint-plugin-asciidoc

Build Status (Travis CI)

An AsciiDoc parser designed to perform validations on AsciiDoc documents using textlint.

⚠️
Alpha warning
This plugin is currently in alpha. Do not expect it to handle all the AsciiDoc syntax correctly. Refer to the test suite to learn what syntax the parser currently supports. The AST created by this plugin is also not yet compatible with any textlint rules. That alignment is expected to happen as the plugin evolves.

Prerequisites

This plugin targets ES6 and is tested using Node (stable). Therefore, you must have at least Node 7 in order to run it.

Usage

const AsciiDocProcessor = require('textlint-plugin-asciidoc').Processor
const processor = new AsciiDocProcessor().processor('.adoc')
const ast = processor.preProcess('Build me a tree.\nI will visit its branches.', '<stdin>')
console.log(ast)
Output
{
  type: 'DocumentNode',
  raw: 'Build me a tree.\nI will visit its branches.',
  range: [ 0, 43 ],
  loc: {
    start: Position { line: 1, column: 0 },
    end: Position { line: 2, column: 26 }
  },
  children: [
    {
      type: 'ParagraphNode',
      range: [ 0, 43 ],
      loc: {
        start: Position { line: 1, column: 0 },
        end: Position { line: 2, column: 26 }
      },
      children: [...]
    }
  ]
}

Copyright © 2017-present Dan Allen and OpenDevise Inc. Free use of this software is granted under the terms of the MIT License. To see the full text of the license, refer to the LICENSE file.