koto-parser
KotoParser: Easily-extensible asynchronous Markdown parser
Last updated 4 years ago by g6123 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koto-parser 
SYNC missed versions from official npm registry.

KotoParser

npm version

KotoParser is an easily-extensible asynchronous Markdown parser. Live Demo.

Install

npm install koto-parser

Usage

In Node.js

const KotoParser = require('koto-parser');

KotoParser.render('I am using **markdown**', function(error, result) {
	console.log(result);
});

In the Browser

<script type="application/javascript" src="koto-parser.js"></script>
<script type="application/javascript">
KotoParser.render('I am using **markdown**', function(error, result) {
	console.log(result);
});
</script>

KotoParser.render(text[, options], callback)

Parses and renders all the blocks and tokens of the given text.

Argument Default Description
text
[options]
[options.blockTypes] An array of block-type plugins
[options.tokenTypes] An array of token-type plugins
[options.sanitize] See index.js An option passed to escape-html-whitelist. To turn off the sanitization, set to false.
callback A callback function that takes two arguments: error and result

KotoParser.parse(text[, options])

Parses all the blocks and tokens of the given text, but not renders them. Returns an array of the root blocks.

Plugin Development Guide

You can easily add or modify the rule by adding a class that extends Block or Token to the options. See the Plugin Development Guide for further information.

Contribution

If you have any bugs, suggestions, or any other questions, please create an issue.

Pull requests are always welcome. Before submitting pull requests, just make sure your changes pass the unit test by running npm test command.

License

MIT

Current Tags

  • 0.2.7                                ...           latest (4 years ago)

12 Versions

  • 0.2.7                                ...           4 years ago
  • 0.2.6                                ...           4 years ago
  • 0.2.5                                ...           4 years ago
  • 0.2.4                                ...           4 years ago
  • 0.2.3                                ...           4 years ago
  • 0.2.2                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |