|
|
vor 5 Tagen | |
|---|---|---|
| .. | ||
| index.js | vor 5 Tagen | |
| package.json | vor 5 Tagen | |
| readme.md | vor 5 Tagen | |
The remark processor is a markdown processor powered by
plugins.
unifiedremark-parseremark-stringifyDon’t need the parser? Or the compiler? That’s OK.
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**