// node.js// can use `require('markdown-it')` for CJSimport markdownit from 'markdown-it'const md = markdownit()const result = md.render('# markdown-it rulezz!');// browser with UMD build, added to "window" on script load// Note, there is no dash in "markdownit".const md = window.markdownit();const result = md.render('# markdown-it rulezz!');
Single line rendering, without paragraph wrap:
import markdownit from 'markdown-it'const md = markdownit()const result = md.renderInline('__markdown-it__ rulezz!');
Init with presets and options
(*) presets define combinations of active rules and options. Can be
"commonmark", "zero" or "default" (if skipped). See
API docs for more details.
import markdownit from 'markdown-it'// commonmark modeconst md = markdownit('commonmark')// default modeconst md = markdownit()// enable everythingconst md = markdownit({ html: true, linkify: true, typographer: true})// full options list (defaults)const md = markdownit({ // Enable HTML tags in source html: false, // Use '/' to close single tags (<br />). // This is only for full CommonMark compatibility.
As you can see, markdown-it doesn't pay with speed for its flexibility.
Slowdown of "full" version caused by additional features not available in
other implementations.
markdown-it is the result of the decision of the authors who contributed to
99% of the Remarkable code to move to a project with the same authorship but
new leadership (Vitaly and Alex). It's not a fork.
References / Thanks
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.