remark is a markdown processor powered by plugins part of the unified collective.
unified
remark-parse
remark-stringify
Don’t need the parser? Or the compiler? That’s OK.
Announcing the unified collective! 🎉 Read more about it on Medium »
npm:
npm install remark
This example lints markdown and turns it into HTML.
var remark = require('remark') var recommended = require('remark-preset-lint-recommended') var html = require('remark-html') var report = require('vfile-reporter') remark() .use(recommended) .use(html) .process('## Hello world!', function(err, file) { console.error(report(err || file)) console.log(String(file)) })
Yields:
1:1 warning Missing newline character at end of file final-newline remark-lint
⚠ 1 warning
<h2>Hello world!</h2>
This example prettifies markdown and configures remark-parse
and remark-stringify
through data.
var remark = require('remark') remark() .data('settings', {commonmark: true, emphasis: '*', strong: '*'}) .process('_Emphasis_ and __importance__', function(err, file) { if (err) throw err console.log(String(file)) })
Yields:
*Emphasis* and **importance**
This example prettifies markdown and configures remark-parse
and remark-stringify
through a preset.
var remark = require('remark') remark() .use({ settings: {commonmark: true, emphasis: '*', strong: '*'} }) .process('_Emphasis_ and __importance__', function(err, file) { if (err) throw err console.log(String(file)) })
Yields:
*Emphasis* and **importance**