# Modules

`@memomori-app/charon` holds `renderToHtml`, `createRenderer`, `createMarkdown`,
`defaultFences`, `preprocessSource`, `renderStaticPage`, `extractToc`, `slugify`
and `CharonError`. Import everything else by its own path, such as
`@memomori-app/charon/assets`.

## Rendering

| Path          | Holds                                                |
| ------------- | ---------------------------------------------------- |
| `parser`      | `renderToHtml`, `preprocessSource`, `createMarkdown` |
| `render-code` | code fences: highlighting, tables, placeholders      |
| `syntax`      | class names, attributes and patterns of the output   |
| `frontmatter` | find, read and strip YAML frontmatter                |
| `toc`         | heading outline and slugs                            |
| `tags`        | tag rules, the tag plugin and `noteTags`             |
| `wiki-target` | parse `path#heading^block\|label` targets            |
| `callouts`    | the callout plugin                                   |
| `source-scan` | fence and code-span masks                            |
| `delimited`   | the CSV and TSV parser                               |
| `geojson`     | the GeoJSON parser                                   |
| `errors`      | `CharonError`                                        |

## Static pages

| Path            | Holds                                              |
| --------------- | -------------------------------------------------- |
| `static-page`   | `renderStaticPage`, which chains the modules below |
| `heading-links` | anchor links on headings, and the list of them     |
| `examples`      | `example` fences shown as source beside output     |
| `assets`        | fill embeds and images from a folder of files      |
| `diagrams`      | draw `.mermaid` blocks as inline SVG with pele     |
| `links`         | resolve `.md` links and wikilinks to routes        |
| `contents`      | the "On this page" list that goes after the h1     |

## Browser

| Path            | Holds                                                 |
| --------------- | ----------------------------------------------------- |
| `geojson-map`   | draw a MapLibre map of GeoJSON                        |
| `embedded-maps` | turn each `.geojson-map` block in a page into a map   |
| `map-style`     | the base style for maps, and whether the page is dark |

`geojson-map` imports MapLibre's CSS, so it needs a bundler that loads CSS
imports. Pass it MapLibre's worker URL as `workerUrl`; in Vite, import
`maplibre-gl/dist/maplibre-gl-worker.mjs?url`.

## Tools

| Path   | Holds                                                                        |
| ------ | ---------------------------------------------------------------------------- |
| `html` | find, change and replace elements in rendered HTML, and `escapeHtml`         |
| `node` | `inlineStylesheet`, `assetFolder` and `mathStylesheetUrl`, for tools in Node |

[Elysium](https://elysium.memomori.app) builds docs sites from these modules.

## Stylesheets

| Path                | Holds                                          |
| ------------------- | ---------------------------------------------- |
| `styles.css`        | `reset.css`, `typography.css` and `charon.css` |
| `reset.css`         | a reset scoped to `.charon`                    |
| `typography.css`    | spacing, sizes and base colors                 |
| `charon.css`        | tokens, code, callouts, tags, links and KaTeX  |
| `heading-links.css` | heading anchors                                |
| `contents.css`      | the "On this page" list above a page           |
| `examples.css`      | source beside output                           |
| `assets.css`        | embedded notes and images                      |
