Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including remark-breaks with all npm packages installed. Try it out:

var remarkBreaks = require("remark-breaks")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

remark-breaks v1.0.5

remark plugin to add break support, without needing spaces

remark-breaks

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to add break support, without needing spaces.

Install

npm:

npm install remark-breaks

Use

Say we have the following file, example.md (note: there are no spaces after a):

This is a
paragraph.

And our script, example.js, looks as follows:

var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var html = require('rehype-stringify')
var breaks = require('remark-breaks')

unified()
  .use(markdown)
  .use(breaks)
  .use(remark2rehype)
  .use(html)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

<p>This is a<br>
paragraph.</p>

Without remark-breaks, you’d get:

<p>This is a
paragraph.</p>

API

remark().use(breaks)

Plugin to add break support without needing spaces. This adds support for GitHub style (in issues, pull requests, comments, and releases) hard breaks without needing spaces before newlines.

Security

Use of remark-breaks does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

Related

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free