remark
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

remark

Markdown processor powered by plugins

11.0.1  •  Updated 8 months ago  •  by Titus Wormer  •  MIT License

Build Coverage Downloads Size Sponsors Backers Chat

unified processor to parse and compile Markdown. Powered by plugins. Part of the unified collective.

Don’t need the parser? Or compiler? That’s OK: use unified directly.

Sponsors



🥇 ZEIT


🥇 Gatsby


🥉 Compositor


Holloway




You?

Read more about the unified collective on Medium »

Install

npm:

npm install remark

Use

See unified for more examples »

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

API

See unified for API docs »

Security

As Markdown is sometimes used for HTML, and improper use of HTML can open you up to a cross-site scripting (XSS) attack, use of remark can also be unsafe. When going to HTML, use remark in combination with the rehype ecosystem, and use rehype-sanitize to make the tree safe.

Use of remark plugins could also open you up to other attacks. Carefully assess each plugin and the risks involved in using them.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help. Ideas for new plugins and tools can be posted in remarkjs/ideas.

A curated list of awesome remark resources can be found in awesome remark.

This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Popularity

Weekly Downloads
1.4M

Maintenance

Development

Last ver 8 months ago
Created 6 years ago
Last commit 1 second ago
1 second between commits

Technology

Node version: 12.2.0
8.3K unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

0 contributors

Tags

unified
remark
markdown
mdast
abstract
syntax
tree
ast
parse
stringify
process
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.