Skip to content

Markdown Syntax ​

markdown-exit supports a wide range of markdown syntax out of the box, following the CommonMark specification with additional extensions.

Presets and Options ​

When initializing an MarkdownExit instance, you can pass options or presets to it for customization.

markdown-exit offers various presets to customize the Markdown parsing and rendering behavior.

ts
// default
const md = createMarkdownExit()

// commonmark preset
const md = createMarkdownExit('commonmark')

For more granular control, you can provide specific options:

ts
const md = createMarkdownExit({
  // Enable HTML tags in source
  html: true,

  // Auto convert URL text to links
  linkify: true,

  // and more ...
})

For all available options, please refer to the MarkdownExitOptions documentation.

Parser Rules ​

Allows for easy customization and extension of the markdown syntax.

You can enable or disable rules for customizing the syntax according to your needs.

ts
import { createMarkdownExit } from 'markdown-exit'

const md = createMarkdownExit()
  .disable(['link', 'image'])
  .enable(['link'])
  .enable('image')

All Available Rules ​

RuleTypedefaultcommonmarkzero
normalizecore✅✅✅
blockcore✅✅✅
strip_referencescore✅✅✅
inlinecore✅✅✅
text_joincore✅✅✅
replacementscoreOpt-in typographer
smartquotescoreOpt-in typographer
linkifycore, inlineOpt-in linkify
tableblock✅
codeblock✅✅
fenceblock✅✅
blockquoteblock✅✅
hrblock✅✅
listblock✅✅
referenceblock✅✅
headingblock✅✅
lheadingblock✅✅
paragraphblock✅✅✅
html_blockblockOpt-in html✅
html_inlineinlineOpt-in html✅
textinline✅✅✅
newlineinline✅✅
escapeinline✅✅
backticksinline✅✅
linkinline✅✅
imageinline✅✅
autolinkinline✅✅
entityinline✅✅
strikethroughinline, inline pairs✅
emphasisinline, inline pairs✅✅
balance_pairsinline pairs✅✅✅
fragments_joininline pairs✅✅✅

Syntax Extensions ​

Refer to the Plugins guide for detailed instructions on how to use or create plugins to enhance the markdown parsing and rendering capabilities.

Released under the MIT License.