Nocturnal Pajama Mutants
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

remark

9.0.0 • Public • Published

remark Build Status Coverage Status Chat

The remark processor is a markdown processor powered by plugins.

Don’t need the parser? Or the compiler? That’s OK.

Installation

npm:

npm install remark

Usage

Common example

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>
Settings through data

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**
Settings through a preset

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**

License

MIT © Titus Wormer

install

npm i remark

Downloadsweekly downloads

462,858

version

9.0.0

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar