Plugins

Extend Comark with powerful plugins for syntax highlighting, emojis, table of contents, math equations, diagrams, and more.

Comark's plugin system extends markdown functionality with specialized features. Plugins can add new syntax, transform content, or enhance rendering.

Core Plugins

Core plugins are built-in and part of the main comark package:

Security

Sanitize markdown by removing dangerous HTML elements and attributes

Emoji

Convert emoji shortcodes like :smile: into emoji characters

Syntax Highlighting

Beautiful code syntax highlighting using Shiki with multi-theme support

Summary

Extract content summaries using <!-- more --> delimiter

Table of Contents

Generate hierarchical TOC from headings automatically

Alerts

Render GitHub-style alert blockquotes with icons and colors (built-in)

External Plugins

External plugins are separate packages that extend Comark with specialized features:

Mermaid

Create diagrams and visualizations using Mermaid syntax in code blocks

Math

Render LaTeX math formulas using KaTeX with inline and display equations

CJK Language

Optimized text handling for Chinese, Japanese, and Korean languages

Use Plugins

Pass plugins to parse() or the <Comark> component:

import { parse } from 'comark'
import emoji from 'comark/plugins/emoji'
import toc from 'comark/plugins/toc'

const result = await parse(content, {
  plugins: [
    emoji(),
    toc({ depth: 3 })
  ]
})
Copyright © 2026