reStructuredText parser and renderer.
Use yarn to fetch the package, or npm if you prefer.
yarn add @frantic1048/Est
After build:
// do not forget the ``@frantic1048`` scope
import est from '@frantic1048/Est'
// directly render rST into HTML string
const html = est.rst2html('reStructuredText string...')
// or...?
// welcome to the dark side...
// generate parsing tree
// which is an ASTy instance
const parse_t = est.parse('reStructuredText string...')
// transfrom parsing tree into doc tree
// which is an ASTy instance
const doc_t = est.transfrom(parse_t)
// render the doc tree into HTML string
const html_the_harder_way = est.render(doc_t)
All node types of the parsed tree can be found from est.TokenTypes
.
The node structure of a specific markup could be referred in test/grammar.<MarkupName>.js
Render function is under constructing.
Prepare:
# fetch source code
git clone https://github.com/frantic1048/Est.git
# fetch dependencies
yarn
Build and run test:
yarn ci
Production build:
yarn dist
Develop:
yarn dev
The build output is under lib
folder. All possible files are:
est.dev.js: | trace on, CommonJS module, debug and develop oriented. |
---|---|
est.min.js: | trace off, single variable, Browser oriented. |
est.js: | trace off, CommonJS module, Node.js oriented. |
Inline: |
|
---|---|
Block-level: |
|