jonschlinkert/remarkable — 5.8k★ on GitHub (JavaScript). Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
See the docs directory for documentation on the following topics:
parser
parsing_block
parsing_core
parsing_inline
plugins
renderer
Options
By default, remarkable is configured to be similar to GFM, but with HTML disabled.
This is easy to change if you prefer different settings.
There are two ways to define options.
constructor
Define options in the constructor:
// Actual default values
var md = new Remarkable({
html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />)
breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks
// Enable some language-neutral replacement + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German.
quotes: '“”‘’',
// Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed
highlight: function (/*str, lang*/) { return ''; }
});
console.log(md.render('# Remarkable rulezz!'));
// => <h1>Remarkable rulezz!</h1>
.set
Or define options via the .set() method:
import { Remarkable } from 'remarkable';
var md = new Remarkable();
md.set({
html: true,
breaks: true
});
Note: To achieve the best possible performance, don't modify a Remarkable
instance on the fly. If you need multiple configurations, create
multiple instances and initialize each with a configuration that is ideal for
that instance.
Presets
Remarkable offers some "presets" as a convenience to quickly enable/disable
active syntax rules and options for common use cases.
commonmark
Enable strict CommonMark mode with the commonmark preset:
import { Remarkable } from 'remarkable';
var md = new Remarkable('commonmark');
full
Enable all available rules (but still with default options, if not set):
import { Remarkable } from 'remarkable';
var md = new Remarkable('full');
// Or with options:
var md = new Remarkable('full', {
html: true,
typographer: true
});
Syntax highlighting
Apply syntax highlighting to fenced code blocks with the highlight option:
import { Remarkable } from 'remarkable';
import hljs from 'highlight.js' // https://highlightjs.org/
// Actual default values
var md = new Remarkable({
highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(lang, str).value;
} catch (err) {}
}
try {
return hljs.highlightAuto(str).value;
} catch (err) {}
return ''; // use external default escaping
}
});
Syntax extensions
Enabled by default:
Footnotes
Tables (GFM)
<del>
(GFM strikethrough) - ~~deleted text~~
Disabled by default:
<sup> - 19^th^
<sub> - H~2~O
abbreviations
<ins> - ++inserted text++ (experimental)
<mark> - ==marked text== (experimental)
HEADS UP!: Experimental extensions can be changed later for something like Critic Markup, but you will still be able to use old-style rules via external plugins if you prefer.
Manage rules
var md = new Remarkable();
md.inline.ruler.enable([ 'ins', 'mark' ]);
md.block.ruler.disable([ 'table', 'footnote' ]);
// Enable everything
md = new Remarkable('full', {
html: true,
typographer: true,
});
//
// Manually enable rules, disabled by default:
//
var md = new Remarkable();
md.core.ruler.enable([
'abbr'
]);
md.block.ruler.enable([
'footnote',
'deflist'
]);
md.inline.ruler.enable([
'footnote_inline',
'ins',
'mark',
'sub',
'sup'
]);
Typographer
Although full-weight typographical replacements are language specific, remarkable
provides coverage for the most common and universal use cases:
Big thanks to John MacFarlane for his work on the
CommonMark spec and reference implementations. His work saved us a lot of time
during this project's development.
Related Links:
https://github.com/jgm/CommonMark - reference CommonMark implementations in C & JS,
also contains latest spec & online demo.
http://talk.commonmark.org - CommonMark forum, good place to collaborate
developers' efforts.
Development / Modification
Parser consists of several responsibility chains filled with
rules. You can reconfigure any of them as you wish. Renderer also
can be modified and extended. See source code to understand details. Pay
attention to these properties:
Here is result of CommonMark spec parse at Core i5 2.4 GHz (i5-4258U):
$ benchmark/benchmark.js spec
Selected samples: (1 of 27)
> spec
Sample: spec.txt (110610 bytes)
> commonmark-reference x 40.42 ops/sec ±4.07% (51 runs sampled)
> current x 74.99 ops/sec ±4.69% (67 runs sampled)
> current-commonmark x 93.76 ops/sec ±1.23% (79 runs sampled)
> marked-0.3.2 x 22.92 ops/sec ±0.79% (41 runs sampled)
As you can see, remarkable doesn't pay with speed for its flexibility. Because
it's written in monomorphic style and uses JIT inline caches effectively.
How active is development on jonschlinkert/remarkable?
The most recent commit recorded on jonschlinkert/remarkable was 2.5 years ago, based on the GitHub push timestamp. The repository has 374 forks — one of the better signals of community interest.
How many stars does jonschlinkert/remarkable have?
jonschlinkert/remarkable has 5.8k GitHub stars — refresh the page for the live number, or check github.com/jonschlinkert/remarkable. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What else is in the Backend space?
jonschlinkert/remarkable is tracked by TopGit under the Backend category, alongside 15 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What language is jonschlinkert/remarkable written in?
jonschlinkert/remarkable is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is jonschlinkert/remarkable associated with?
Where do I read more about jonschlinkert/remarkable?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/jonschlinkert/remarkable is the definitive source.
Why is jonschlinkert/remarkable categorized under Backend?
TopGit places jonschlinkert/remarkable in the Backend category based on its GitHub topics and description (tagged: "commonmark", "compile", "docusaurus"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Still deciding about remarkable?
One click hands the question to an AI along with this page — see what it says about remarkable.