JS实现的 Markdown 解析器:markdown-it
lope
10年前
这是一个用于Node.JS和浏览器环境的Markdown解析器,100% CommonMark 支持, 可扩展, 语法插件并且速度快。
- Supports the CommonMark spec + syntax extensions + sugar (URL autolinking, typographer).
- Configurable syntax! You can add new rules and even replace existing ones.
- High speed!
- Community-written plugins and other packages on npm.
// node.js, "classic" way: var MarkdownIt = require('markdown-it'), md = new MarkdownIt(); var result = md.render('# markdown-it rulezz!'); // node.js, the same, but with sugar: var md = require('markdown-it')(); var result = md.render('# markdown-it rulezz!'); // browser without AMD, added to "window" on script load // Note, there are no dash. var md = window.markdownit(); var result = md.render('# markdown-it rulezz!');