Remarkable是一个纯JavaScript的Markdown解析器,解析速度快而且易于扩展。100%支持Commonmark
使用方法:
var Remarkable = require('remarkable');// This values are defaultvar md = new Remarkable({ html: false, // Enable html tags in source xhtmlOut: false, // Use '/' to close single tags (<br />) breaks: false, // Convert '\n' in paragraphs into <br> langPrefix: 'language-', // CSS language prefix for fenced blocks linkify: false, // Autoconvert url-like texts to links typographer: false, // Enable smartypants and other sweet transforms // Highlighter function. Should return escaped html, // or '' if input not changed highlight: function (/*str, , lang*/) { return ''; }});console.log(md.render('# Remarkable rulezz!'));// => <h1>Remarkable rulezz!</h1>
评论