JSPM

  • Created
  • Published
  • Downloads 2132847
  • Score
    100M100P100Q191178F
  • License MIT

Markdown processor powered by plugins part of the unified collective

Package Exports

  • remark
  • remark/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark

Build Coverage Downloads Size Sponsors Backers Chat

unified processor to parse and serialize markdown. Built on micromark. Powered by plugins. Part of the unified collective.

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

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install remark

Use

See unified for more examples »

Common example

This example lints markdown and turns it into HTML.

import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkPresetLintRecommended from 'remark-preset-lint-recommended'
import remarkHtml from 'remark-html'

remark()
  .use(remarkPresetLintRecommended)
  .use(remarkHtml)
  .process('## Hello world!')
  .then((file) => {
    console.error(reporter(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-stringify through data.

import {remark} from 'remark'

remark()
  .data('settings', {emphasis: '*', strong: '*'})
  .process('_Emphasis_ and __importance__')
  .then((file) => {
    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.

import {remark} from 'remark'

remark()
  .use({settings: {emphasis: '*', strong: '*'}})
  .process('_Emphasis_ and __importance__')
  .then((file) => {
    console.log(String(file))
  })

Yields:

*Emphasis* and **importance**

API

See unified for API docs »

This package exports the following identifier: remark. There is no default export.

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, organization, or community you agree to abide by its terms.

Support this effort and give back by sponsoring on OpenCollective!

Gatsby 🥇

Vercel 🥇

Netlify

Holloway

ThemeIsle

Boost Hub

Expo


You?

License

MIT © Titus Wormer