Charon
Docs menu

Code blocks

Highlighted code #

```ts
const fare = (heads: number) => heads * 1
```
const fare = (heads: number) => heads * 1

Name the language after the backticks to color the code. Every block gets a copy button; a docs site wires it up, and in your own page startDocs or a click handler of yours does.

Tables from CSV #

```csv
river,meaning,length km
Styx,hate,
Acheron,woe,58
Lethe,forgetting,
```
rivermeaninglength km
Styxhate
Acheronwoe58
Letheforgetting

A csv or tsv fence draws a table. The first row becomes the header. parseDelimited from @memomori/charon/delimited is the parser behind it.

Diagrams #

```mermaid
graph LR
  Shore --> Ferry --> Underworld
  Ferry -.-> Shore
```
ShoreFerryUnderworld

A mermaid fence renders as <div class="mermaid" data-content="…">, its source in base64 UTF-8. To draw it as inline SVG at build time, use the diagrams module, which needs pele. A docs site draws every diagram for you.

Maps #

```geojson
{
  "type": "Point",
  "coordinates": [
    21.6,
    39.2
  ]
}
```

A geojson fence renders as <div class="geojson-map" data-content="…">. To draw the maps in the browser, take them from the page:

import { embeddedMaps } from '@memomori/charon/embedded-maps'
import { tileStyle } from '@memomori/charon/map-style'

const maps = embeddedMaps(tileStyle('light'))
maps.take(article)

Each map draws once it nears the screen. restyle swaps the style, for a dark theme, and remove tears them all down. It needs maplibre-gl and Vite. tileStyle points at OpenFreeMap. A docs site leaves maps alone.

Examples #

```example
**Bold** and _italic_.
```

An example fence shows its source beside its output, as on every page here. Turn it on with examples in renderStaticPage, --examples on the CLI, or use a docs site, which always has it.

Your own fences #

Give any language your own renderer, or turn off a built-in one. See Custom fences.

Last updated