remark plugin to add break support, without needing spaces.
This plugin is ready for the new parser in remark
(micromark
,
see remarkjs/remark#536
).
A patch version was released (2.0.1
) that works with old and new remark.
npm:
npm install remark-breaks
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>
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.
Use of remark-breaks
does not involve rehype (hast)
or user content so there are no openings for cross-site scripting (XSS)
attacks.
remark-gfm
— GitHub Flavored Markdownremark-github
— Auto-link references like in GitHub issues, PRs, and commentsremark-footnotes
— Footnotesremark-frontmatter
— Frontmatter (YAML, TOML, and more) supportremark-math
— Math
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.