Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

remark-breaks

1.0.2 • Public • Published

remark-breaks

Build Coverage Downloads Chat Sponsors Backers

Breaks support, without needing spaces, for remark.

Installation

npm:

npm install remark-breaks

Usage

Say we have the following file, example.md (note: there’s 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)

Add support for GitHub style (in issues, pull requests, comments, and releases) hard breaks without needing spaces before newlines.

Related

Contribute

See contributing.md in remarkjs/remark for ways to get started.

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

License

MIT © Titus Wormer

install

npm i remark-breaks

Downloadsweekly downloads

8,952

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability