Typographic callout library. Drop this into a system prompt to give your output editorial design.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/marginalia@latest/marginalia.css">
<script src="https://cdn.jsdelivr.net/npm/marginalia@latest/marginalia.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/marginalia@latest/marginalia-md.js" defer></script>JS is optional. CSS handles everything. marginalia-md.js converts the markdown patterns below to styled HTML via Marginalia.md(str).
Write standard markdown. These patterns convert to Marginalia components:
> [!NOTE]
> Informational aside.
> [!TIP]
> Helpful suggestion.
> [!WARNING]
> Potential pitfall.
> [!IMPORTANT]
> Critical information.
> Any blockquote without an alert keyword becomes a 3D pull quote.
> [!QUOTE]
> Attributed or emphasized quotation.
```js
function example() { return true; }
```
==highlighted text== → themed highlight
`inline code` → monospace snippet
{Badge} → accent label
{Badge: tip} → typed label (tip | warning | important)
[^1](Footnote text here) → auto-numbered popover footnote
> [!ASIDE]
> Tangential note that floats beside body text.
> [!MARGIN]
> Escapes to the gutter on wide screens, inline on mobile.
{dropcap}
Opening paragraph gets a large decorative initial letter.
<details>
<summary>Click to expand</summary>
<div class="mg-collapse-body">
Hidden content here.
</div>
</details>Browser: Marginalia.md(markdownString) returns HTML string.
Node: require('./marginalia-md').convert(markdownString) returns HTML string.
npm install marginaliaimport 'marginalia/marginalia.css';
import { convert } from 'marginalia/marginalia-md';
document.querySelector('#content').innerHTML = convert(markdownString);- Dark theme by default. Add
data-mg-theme="light"to<html>for light mode. - Plain
>blockquotes become 3D perspective pull quotes — the signature component. Text auto-aligns toward the border accent. - All components work without JavaScript. JS adds copy buttons, smooth collapse, and lightbox.
- Add
data-bar="none"to any element to remove the left border accent. - Use
data-content="repeat"when quoting source text,data-content="insert"for original commentary.