Charon
Docs menu

Install

npm install @memomori/charon

Charon needs Node 22.18 or later. It ships as ES modules.

Optional packages #

A few modules use a package you install only if you need them:

Package Needed by
pele diagrams and mermaid fences
satori and @resvg/resvg-js social cards on a docs site
maplibre-gl geojson-map and embedded-maps

Without one, the module that needs it throws a CharonError that names the package.

Imports #

The root path holds the functions most projects use:

import {
  renderToHtml,
  createRenderer,
  createMarkdown,
  defaultFences,
  preprocessSource,
  renderStaticPage,
  extractToc,
  slugify,
  CharonError,
} from '@memomori/charon'

Every other module has its own path, such as @memomori/charon/assets. See Modules.

Safety #

The parser keeps raw HTML. Sanitize its output before you put text from users in a page, with DOMPurify or your own sanitizer.

Last updated