Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

docs(open-knowledge): component reference with live previews (#2480)

Abrahamd0e91fa4c3c7
diff --git a/bun.lock b/bun.lock
index c2de3a0f2..ab08277fc 100644
--- a/bun.lock
+++ b/bun.lock
@@ -31,6 +31,7 @@
"fumadocs-core": "~16.1.0",
"fumadocs-mdx": "~14.0.3",
"fumadocs-ui": "~16.1.0",
+ "katex": "^0.16.22",
"lucide-react": "^0.503.0",
"mermaid": "^11.12.3",
"next": "^16",
diff --git a/docs/content/reference/components/accordion.mdx b/docs/content/reference/components/accordion.mdx
new file mode 100644
index 000000000..c4a6e8181
--- /dev/null
+++ b/docs/content/reference/components/accordion.mdx
@@ -0,0 +1,65 @@
+---
+title: "Accordion"
+description: "Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX"
+keywords: "toggle, accordion, expandable, details, disclosure, collapse, fold"
+---
+
+## Example
+
+<ComponentPreview>
+ <AccordionPreview title="Show me the details" description="Click to expand" icon="lucide:BookOpen">
+ Native `<details>` under the hood — same substrate as the app render.
+ Pass a shared `name` to sibling accordions and the browser will keep
+ only one open at a time.
+ </AccordionPreview>
+</ComponentPreview>
+
+```mdx
+<Accordion title="Title">
+ Body content revealed when the accordion is expanded.
+</Accordion>
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "title": {
+ description: "Accordion heading shown inside the <summary>",
+ type: "string",
+ required: true,
+ },
+ "defaultOpen": {
+ description: "When true, the accordion renders expanded on initial load",
+ type: "boolean",
+ required: false,
+ default: "false",
+ },
+ "icon": {
+ description: "Custom lucide icon override (e.g. \\`lucide:Rocket\\`)",
+ type: "string",
+ required: false,
+ },
+ "description": {
+ description: "Optional subtitle rendered below the title inside <summary>",
+ type: "string",
+ required: false,
+ },
+ "id": {
+ description: "HTML id attribute for deep-linking (e.g. \\`#advanced-options\\`)",
+ type: "string",
+ required: false,
+ },
+ "name": {
+ description: "HTML5 <details name=> group — siblings with the same name are mutually exclusive",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `toggle`, `accordion`, `expandable`, `details`, `disclosure`, `collapse`, `fold`
+
+## Author it
+
+Type `/toggle` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/audio.mdx b/docs/content/reference/components/audio.mdx
new file mode 100644
index 000000000..92b2836c7
--- /dev/null
+++ b/docs/content/reference/components/audio.mdx
@@ -0,0 +1,68 @@
+---
+title: "Audio"
+description: "HTML5 audio player with native controls"
+keywords: "audio, sound, music, mp3, podcast, player"
+---
+
+## Example
+
+<ComponentPreview>
+ <AudioPreview
+ src="https://actions.google.com/sounds/v1/alarms/beep_short.ogg"
+ controls
+ />
+</ComponentPreview>
+
+```md
+![[podcast-episode.mp3]]
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "Audio source URL",
+ type: "string",
+ required: true,
+ default: "",
+ },
+ "controls": {
+ description: "Show native HTML5 audio controls (defaults to true)",
+ type: "boolean",
+ required: false,
+ default: "true",
+ },
+ "autoplay": {
+ description: "Begin playback as soon as possible (usually requires muted)",
+ type: "boolean",
+ required: false,
+ },
+ "title": {
+ description: "Native HTML title attribute (tooltip)",
+ type: "string",
+ required: false,
+ },
+ "muted": {
+ description: "Mute audio on load",
+ type: "boolean",
+ required: false,
+ },
+ "loop": {
+ description: "Restart from the beginning when playback ends",
+ type: "boolean",
+ required: false,
+ },
+ "preload": {
+ description: "Hint for how much of the audio to preload",
+ type: "'none' | 'metadata' | 'auto'",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `audio`, `sound`, `music`, `mp3`, `podcast`, `player`
+
+## Author it
+
+Type `/audio` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/callout.mdx b/docs/content/reference/components/callout.mdx
new file mode 100644
index 000000000..1383b4488
--- /dev/null
+++ b/docs/content/reference/components/callout.mdx
@@ -0,0 +1,72 @@
+---
+title: "Callout"
+description: "Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)"
+keywords: "note, tip, important, warning, caution, abstract, info, todo, success, question, failure, danger"
+---
+
+## Example
+
+<ComponentPreview>
+ <CalloutPreview type="tip" title="Ship a good default">
+ Pick the type that matches the intent — <code>tip</code> for advice,
+ <code>warning</code> for things that can bite, <code>note</code> for
+ background context. The icon and accent color track the type automatically.
+ </CalloutPreview>
+</ComponentPreview>
+
+```md
+> [!TIP]
+> Pick the type that matches the intent — `tip` for advice, `warning`
+> for things that can bite, `note` for background context.
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "type": {
+ description: "Callout variant",
+ type: "'note' | 'tip' | 'important' | 'warning' | 'caution' | 'abstract' | 'info' | 'todo' | 'success' | 'question' | 'failure' | 'danger' | 'bug' | 'example' | 'quote'",
+ required: false,
+ default: "note",
+ },
+ "title": {
+ description: "Optional heading shown above the body",
+ type: "string",
+ required: false,
+ },
+ "icon": {
+ description: "Custom lucide icon override (e.g. \\`lucide:Lightbulb\\`)",
+ type: "string",
+ required: false,
+ },
+ "color": {
+ description: "Optional accent color override (hex — e.g. \\`#F05032\\`)",
+ type: "string",
+ required: false,
+ },
+ "collapsible": {
+ description: "Render as a foldable \\`<details>\\` (Obsidian \\`[!TYPE]+/-\\`)",
+ type: "boolean",
+ required: false,
+ default: "false",
+ },
+ "defaultOpen": {
+ description: "When collapsible, start in the open state",
+ type: "boolean",
+ required: false,
+ default: "true",
+ },
+ "children": {
+ description: "Callout content",
+ type: "ReactNode",
+ required: true,
+ },
+}}
+/>
+
+_Also matches:_ `note`, `tip`, `important`, `warning`, `caution`, `abstract`, `info`, `todo`, `success`, `question`, `failure`, `danger`, `bug`, `example`, `quote`, `alert`, `admonition`, `callout`
+
+## Author it
+
+Type `/note` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/embed.mdx b/docs/content/reference/components/embed.mdx
new file mode 100644
index 000000000..4187a0797
--- /dev/null
+++ b/docs/content/reference/components/embed.mdx
@@ -0,0 +1,52 @@
+---
+title: "Embed"
+description: "Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src=\"…\">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback"
+keywords: "embed, iframe, website, page, inline, frame, preview"
+---
+
+## Example
+
+<ComponentPreview>
+ <EmbedPreview
+ src="https://openknowledge.ai/"
+ title="OpenKnowledge marketing site"
+ />
+</ComponentPreview>
+
+```mdx
+<Embed src="" title="Title" />
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "Embedded page URL (must start with http:// or https://)",
+ type: "string",
+ required: true,
+ default: "",
+ },
+ "title": {
+ description: "Iframe title (accessible label for screen readers)",
+ type: "string",
+ required: false,
+ },
+ "width": {
+ description: "Embed width as a CSS length (e.g. \"100%\", \"640px\")",
+ type: "string",
+ required: false,
+ },
+ "height": {
+ description: "Embed height as a CSS length (e.g. \"26rem\", \"480px\")",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `embed`, `iframe`, `website`, `page`, `inline`, `frame`, `preview`
+
+## Author it
+
+Type `/embed` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/file.mdx b/docs/content/reference/components/file.mdx
new file mode 100644
index 000000000..97ca170c4
--- /dev/null
+++ b/docs/content/reference/components/file.mdx
@@ -0,0 +1,34 @@
+---
+title: "File"
+description: "Downloadable file attachment — inline row with name + size + download link"
+keywords: "file, attachment, download, document, zip, docx, doc"
+---
+
+## Example
+
+<ComponentPreview>
+ <FilePreview name="quarterly-report.pdf" size="124 KB" />
+</ComponentPreview>
+
+```md
+![[quarterly-report.pdf]]
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "File URL",
+ type: "string",
+ required: true,
+ default: "",
+ },
+}}
+/>
+
+_Also matches:_ `file`, `attachment`, `download`, `document`, `zip`, `docx`, `doc`
+
+## Author it
+
+Type `/file` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/img.mdx b/docs/content/reference/components/img.mdx
new file mode 100644
index 000000000..dccb5c29c
--- /dev/null
+++ b/docs/content/reference/components/img.mdx
@@ -0,0 +1,96 @@
+---
+title: "Image"
+description: "Image with click-to-zoom and HTML-native attributes"
+keywords: "image, zoom, picture, photo"
+---
+
+## Example
+
+<ComponentPreview>
+ <ImgPreview
+ src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=800&q=80"
+ alt="Forest at sunrise"
+ caption="A photo from Unsplash — click to zoom in the app."
+ />
+</ComponentPreview>
+
+```md
+![A short description](./path/to/image.png)
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "Image source URL",
+ type: "string",
+ required: true,
+ default: "",
+ },
+ "alt": {
+ description: "Alt text",
+ type: "string",
+ required: true,
+ },
+ "width": {
+ description: "Image width",
+ type: "number",
+ required: false,
+ },
+ "height": {
+ description: "Image height",
+ type: "number",
+ required: false,
+ },
+ "srcset": {
+ description: "Responsive image candidate set (e.g. \"x.png 1x, y.png 2x\")",
+ type: "string",
+ required: false,
+ },
+ "sizes": {
+ description: "Responsive image sizes hint paired with srcset",
+ type: "string",
+ required: false,
+ },
+ "loading": {
+ description: "Native img loading strategy (defaults to lazy)",
+ type: "'eager' | 'lazy'",
+ required: false,
+ default: "lazy",
+ },
+ "title": {
+ description: "Native HTML title attribute (tooltip)",
+ type: "string",
+ required: false,
+ },
+ "decoding": {
+ description: "Hint for how the browser should decode the image",
+ type: "'sync' | 'async' | 'auto'",
+ required: false,
+ default: "auto",
+ },
+ "fetchpriority": {
+ description: "Resource fetch priority hint",
+ type: "'high' | 'low' | 'auto'",
+ required: false,
+ default: "auto",
+ },
+ "crossorigin": {
+ description: "CORS mode for the image fetch",
+ type: "'anonymous' | 'use-credentials'",
+ required: false,
+ },
+ "referrerpolicy": {
+ description: "Referrer policy for the image fetch (HTML referrerpolicy values)",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `image`, `zoom`, `picture`, `photo`
+
+## Author it
+
+Type `/image` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/index.mdx b/docs/content/reference/components/index.mdx
new file mode 100644
index 000000000..8e76facbc
--- /dev/null
+++ b/docs/content/reference/components/index.mdx
@@ -0,0 +1,35 @@
+---
+title: Overview
+description: The rich content blocks the OpenKnowledge editor understands — callouts, media, math, mermaid diagrams, accordions, tabs, and transclusion.
+---
+
+OpenKnowledge documents are plain markdown, plus a small set of rich content blocks the editor understands out of the box — callouts, media, math, mermaid diagrams, accordions, tabs, and transclusion. Type `/` in the editor to insert one from the slash menu, or write it directly in source mode.
+
+Every block on this page uses the same tag syntax in the raw markdown file:
+
+```mdx
+<Callout type="tip" title="Nice">
+ Prose or nested markdown lives in the body.
+</Callout>
+```
+
+## Content
+
+- [Callout](/docs/reference/components/callout) — alerts and admonitions with 15 type variants
+- [Accordion](/docs/reference/components/accordion) — collapsible sections
+- [Tabs](/docs/reference/components/tabs) — grouped panel switcher (with `<Tab>` children)
+- [Math](/docs/reference/components/math) — KaTeX-rendered inline or block equations
+- [MermaidFence](/docs/reference/components/mermaid-fence) — diagrams from a ` ```mermaid ` fence
+
+## Media
+
+- [img](/docs/reference/components/img) — image with click-to-zoom
+- [video](/docs/reference/components/video) — video player
+- [audio](/docs/reference/components/audio) — audio player
+- [Pdf](/docs/reference/components/pdf) — embedded multi-page PDF viewer
+- [File](/docs/reference/components/file) — inline download row for arbitrary attachments
+- [Embed](/docs/reference/components/embed) — sandboxed iframe for external URLs
+
+## Transclusion
+
+- [Mirror](/docs/reference/components/mirror) — read-only view of a `<MirrorSource>` block from another doc
diff --git a/docs/content/reference/components/math.mdx b/docs/content/reference/components/math.mdx
new file mode 100644
index 000000000..73bc32233
--- /dev/null
+++ b/docs/content/reference/components/math.mdx
@@ -0,0 +1,45 @@
+---
+title: "Math"
+description: "Block math equation rendered with KaTeX from a LaTeX source string"
+keywords: "math, latex, equation, formula, katex, tex"
+---
+
+## Example
+
+<ComponentPreview>
+ <MathPreview formula="E = mc^2" />
+</ComponentPreview>
+
+```md
+$$
+E = mc^2
+$$
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "formula": {
+ description: "LaTeX math source (rendered with KaTeX in the browser)",
+ type: "string",
+ required: true,
+ },
+ "id": {
+ description: "HTML id attribute for deep-linking (e.g. \\`#eq-pythagoras\\`)",
+ type: "string",
+ required: false,
+ },
+ "language": {
+ description: "Forward-compat hint for the math source language (default \\`latex\\`). Reserved for future MathJax / Typst / AsciiMath substrates.",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `math`, `latex`, `equation`, `formula`, `katex`, `tex`
+
+## Author it
+
+Type `/math` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/mermaid-fence.mdx b/docs/content/reference/components/mermaid-fence.mdx
new file mode 100644
index 000000000..6272270be
--- /dev/null
+++ b/docs/content/reference/components/mermaid-fence.mdx
@@ -0,0 +1,35 @@
+---
+title: "Mermaid"
+description: "Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code"
+keywords: "mermaid, diagram, flowchart, graph, sequence, sequencediagram, class, state, er, erdiagram, gantt, pie"
+---
+
+## Example
+
+<ComponentPreview>
+ <Mermaid chart={`graph LR
+ Author((Author)) --> Editor[OK Editor]
+ Editor -- CRDT --> Server[(Hocuspocus)]
+ Server --> Agent{{AI Agent}}
+ Agent --> Editor`} />
+</ComponentPreview>
+
+````text
+```mermaid
+graph LR
+ Author((Author)) --> Editor[OK Editor]
+ Editor -- CRDT --> Server[(Hocuspocus)]
+ Server --> Agent{{AI Agent}}
+ Agent --> Editor
+```
+````
+
+## Props
+
+_No public props._
+
+_Also matches:_ `mermaid`, `diagram`, `flowchart`, `graph`, `sequence`, `sequencediagram`, `class`, `state`, `er`, `erdiagram`, `gantt`, `pie`, `chart`
+
+## Author it
+
+Type `/mermaid` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/meta.json b/docs/content/reference/components/meta.json
new file mode 100644
index 000000000..8edca9e25
--- /dev/null
+++ b/docs/content/reference/components/meta.json
@@ -0,0 +1,19 @@
+{
+ "title": "Components",
+ "icon": "LuBlocks",
+ "pages": [
+ "index",
+ "callout",
+ "accordion",
+ "tabs",
+ "math",
+ "mermaid-fence",
+ "img",
+ "video",
+ "audio",
+ "pdf",
+ "file",
+ "embed",
+ "mirror"
+ ]
+}
diff --git a/docs/content/reference/components/mirror.mdx b/docs/content/reference/components/mirror.mdx
new file mode 100644
index 000000000..1a643b431
--- /dev/null
+++ b/docs/content/reference/components/mirror.mdx
@@ -0,0 +1,75 @@
+---
+title: "Mirror"
+description: "Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change"
+keywords: "mirror, sync, synced, transclude, embed, reference, shared block"
+---
+
+## Example
+
+<ComponentPreview>
+ <MirrorPreview src="specs/architecture" anchor="overview-diagram">
+ This body renders live from wherever the `<MirrorSource id="overview-diagram">`
+ with a matching id lives — edits there ripple here without a copy step.
+ </MirrorPreview>
+</ComponentPreview>
+
+````text
+```mdx
+<Mirror src="specs/architecture" anchor="overview-diagram" />
+```
+````
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "Path of the source doc, extension-less (e.g. \\`api-spec\\`).",
+ type: "string",
+ required: true,
+ },
+ "anchor": {
+ description: "Id of the \\`<MirrorSource>\\` block within the source doc.",
+ type: "string",
+ required: true,
+ },
+}}
+/>
+
+## Also: `<MirrorSource>`
+
+Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.
+
+<ComponentPreview>
+ <MirrorSourcePreview id="overview-diagram">
+ The canonical content this block owns. Every `<Mirror>` that references
+ this id anywhere in the project reads from here.
+ </MirrorSourcePreview>
+</ComponentPreview>
+
+```mdx
+<MirrorSource id="demo-1">
+ Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.
+</MirrorSource>
+```
+
+<TypeTable
+ type={{
+ "id": {
+ description: "Stable id agents and authors use to reference this block from \\`<Mirror>\\` elsewhere.",
+ type: "string",
+ required: true,
+ },
+ "children": {
+ description: "Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.",
+ type: "ReactNode",
+ required: true,
+ },
+}}
+/>
+
+_Also matches:_ `mirror`, `sync`, `synced`, `transclude`, `embed`, `reference`, `shared block`
+
+## Author it
+
+Type `/mirror` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/pdf.mdx b/docs/content/reference/components/pdf.mdx
new file mode 100644
index 000000000..c31d239fa
--- /dev/null
+++ b/docs/content/reference/components/pdf.mdx
@@ -0,0 +1,44 @@
+---
+title: "PDF"
+description: "Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)"
+keywords: "pdf, document, embed, pdfjs"
+---
+
+## Example
+
+<ComponentPreview>
+ <PdfPreview src="https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf" />
+</ComponentPreview>
+
+```mdx
+<Pdf src="" title="Title" />
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "PDF source URL",
+ type: "string",
+ required: true,
+ default: "",
+ },
+ "title": {
+ description: "Accessible label for the embedded PDF viewer",
+ type: "string",
+ required: false,
+ },
+ "anchor": {
+ description: "PDF viewer parameters as a single URL-fragment string (e.g. \\`page=3&height=600\\`)",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `pdf`, `document`, `embed`, `pdfjs`
+
+## Author it
+
+Type `/pdf` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/tabs.mdx b/docs/content/reference/components/tabs.mdx
new file mode 100644
index 000000000..ee09e29be
--- /dev/null
+++ b/docs/content/reference/components/tabs.mdx
@@ -0,0 +1,87 @@
+---
+title: "Tabs"
+description: "Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload)"
+keywords: "tabs, tabbed, panels, tabgroup, switcher"
+---
+
+## Example
+
+<ComponentPreview>
+ <TabsPreview>
+ <TabPreview label="Install">
+ Run `npm install @inkeep/open-knowledge` to add the CLI to your project.
+ </TabPreview>
+ <TabPreview label="Configure">
+ Point `.ok/config.yml` at your content directory. Frontmatter, ignore
+ patterns, and folder defaults all live in this one file.
+ </TabPreview>
+ <TabPreview label="Serve">
+ `ok start` boots the collaboration server and opens the editor.
+ </TabPreview>
+ </TabsPreview>
+</ComponentPreview>
+
+```mdx
+<Tabs>
+ <Tab label="One">Body of the first tab panel.</Tab>
+ <Tab label="Two">Body of the second tab panel.</Tab>
+</Tabs>
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "id": {
+ description: "HTML id attribute for deep-linking (e.g. \\`#install-tabs\\`)",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+## Also: `<Tab>`
+
+A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.
+
+<ComponentPreview>
+ <TabsPreview>
+ <TabPreview label="A single Tab">
+ Each <code>&lt;Tab&gt;</code> is one panel of a <code>&lt;Tabs&gt;</code>
+ group. The <code>label</code> becomes the pill at the top; the body
+ renders when the pill is active.
+ </TabPreview>
+ <TabPreview label="Second panel">
+ Switch between panels without losing scroll — the parent tracks which
+ one is active client-side.
+ </TabPreview>
+ </TabsPreview>
+</ComponentPreview>
+
+```mdx
+<Tab label="Tab">
+ Panel content — must be nested inside a `<Tabs>` parent.
+</Tab>
+```
+
+<TypeTable
+ type={{
+ "label": {
+ description: "Tab strip label — shown in the clickable pill at the top",
+ type: "string",
+ required: true,
+ default: "Tab",
+ },
+ "id": {
+ description: "HTML id attribute for deep-linking (e.g. \\`#tab-npm\\`)",
+ type: "string",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `tabs`, `tabbed`, `panels`, `tabgroup`, `switcher`
+
+## Author it
+
+Type `/tabs` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/components/video.mdx b/docs/content/reference/components/video.mdx
new file mode 100644
index 000000000..6df6ba5a9
--- /dev/null
+++ b/docs/content/reference/components/video.mdx
@@ -0,0 +1,88 @@
+---
+title: "Video"
+description: "HTML5 video player with native controls"
+keywords: "video, media, player, mp4, webm, movie"
+---
+
+## Example
+
+<ComponentPreview>
+ <VideoPreview
+ src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
+ controls
+ />
+</ComponentPreview>
+
+```md
+![[demo-clip.mp4]]
+```
+
+## Props
+
+<TypeTable
+ type={{
+ "src": {
+ description: "Video source URL",
+ type: "string",
+ required: true,
+ default: "",
+ },
+ "controls": {
+ description: "Show native HTML5 video controls (defaults to true)",
+ type: "boolean",
+ required: false,
+ default: "true",
+ },
+ "autoplay": {
+ description: "Begin playback as soon as possible (usually requires muted)",
+ type: "boolean",
+ required: false,
+ },
+ "poster": {
+ description: "Poster image URL shown before playback",
+ type: "string",
+ required: false,
+ },
+ "width": {
+ description: "Video width",
+ type: "number",
+ required: false,
+ },
+ "height": {
+ description: "Video height",
+ type: "number",
+ required: false,
+ },
+ "title": {
+ description: "Native HTML title attribute (tooltip)",
+ type: "string",
+ required: false,
+ },
+ "muted": {
+ description: "Mute audio on load",
+ type: "boolean",
+ required: false,
+ },
+ "loop": {
+ description: "Restart from the beginning when playback ends",
+ type: "boolean",
+ required: false,
+ },
+ "playsinline": {
+ description: "Play inline on iOS rather than entering fullscreen",
+ type: "boolean",
+ required: false,
+ },
+ "preload": {
+ description: "Hint for how much of the video to preload",
+ type: "'none' | 'metadata' | 'auto'",
+ required: false,
+ },
+}}
+/>
+
+_Also matches:_ `video`, `media`, `player`, `mp4`, `webm`, `movie`
+
+## Author it
+
+Type `/video` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
diff --git a/docs/content/reference/meta.json b/docs/content/reference/meta.json
index 031d4bd54..b01a5fac0 100644
--- a/docs/content/reference/meta.json
+++ b/docs/content/reference/meta.json
@@ -7,6 +7,7 @@
"cli",
"configuration",
"mcp",
+ "components",
"what-open-knowledge-writes"
]
}
diff --git a/docs/package.json b/docs/package.json
index f5ad283db..4e8dbc0ff 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -14,6 +14,7 @@
"validate-link": "bun scripts/validate-link.ts",
"generate:og-wordmark": "bun scripts/generate-og-wordmark.ts",
"generate:brand-assets": "bun scripts/generate-brand-assets.ts",
+ "generate:component-docs": "bun scripts/generate-component-docs.ts",
"postinstall": "fumadocs-mdx"
},
"dependencies": {
@@ -27,6 +28,7 @@
"fumadocs-core": "~16.1.0",
"fumadocs-mdx": "~14.0.3",
"fumadocs-ui": "~16.1.0",
+ "katex": "^0.16.22",
"lucide-react": "^0.503.0",
"mermaid": "^11.12.3",
"next": "^16",
diff --git a/docs/scripts/generate-component-docs.ts b/docs/scripts/generate-component-docs.ts
new file mode 100644
index 000000000..6707cd637
--- /dev/null
+++ b/docs/scripts/generate-component-docs.ts
@@ -0,0 +1,491 @@
+#!/usr/bin/env bun
+/**
+ * Generate one MDX page per canonical OpenKnowledge JSX component under
+ * `content/reference/components/`. Reads `builtInComponents` from
+ * `@inkeep/open-knowledge-core` so the docs stay in lockstep with the
+ * runtime manifest.
+ *
+ * Compat descriptors (GfmCallout, CommonMarkImage, WikiEmbed*) are skipped
+ * — they're read-only round-trip helpers, never author-facing.
+ *
+ * Wildcard `*` is skipped — it's the fallback renderer, not a component.
+ */
+
+import { mkdir, writeFile } from 'node:fs/promises';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import type { PropDef } from '@inkeep/open-knowledge-core';
+import { builtInComponents } from '@inkeep/open-knowledge-core';
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const OUT_DIR = path.resolve(HERE, '../content/reference/components');
+
+// Ordered list drives the sidebar. Canonical shipping order matches the
+// slash-menu grouping: content first, then media, then transclusion.
+// Composition children (Tab, MirrorSource) don't get their own pages —
+// they're rolled into the parent's doc via COMPOSITION_CHILDREN below,
+// since they only make sense in that context.
+const PAGE_ORDER = [
+ 'Callout',
+ 'Accordion',
+ 'Tabs',
+ 'Math',
+ 'MermaidFence',
+ 'img',
+ 'video',
+ 'audio',
+ 'Pdf',
+ 'File',
+ 'Embed',
+ 'Mirror',
+] as const;
+
+/**
+ * Parent → child pairs where the child ONLY makes sense inside the
+ * parent's tag (`<Tab>` inside `<Tabs>`, `<MirrorSource>` at the far end
+ * of a `<Mirror src=… anchor=…>`). Rendered as an appended "Also:" block
+ * on the parent's page instead of a standalone sidebar entry. Keys are
+ * canonical descriptor names.
+ */
+const COMPOSITION_CHILDREN: Partial<Record<string, string>> = {
+ Tabs: 'Tab',
+ Mirror: 'MirrorSource',
+};
+
+const COMPOSITION_CHILD_NAMES = new Set(Object.values(COMPOSITION_CHILDREN));
+
+/**
+ * Every component has a most-idiomatic authoring form the reader should see
+ * first. For most that's a plain markdown / GFM / wikilink / fence
+ * shape; a few (Tabs / Pdf / Embed / Mirror / MirrorSource) only exist as
+ * JSX and fall through to the auto-emitted `<Tag …>` example.
+ *
+ * Each entry is `{ language, code }` where `language` is the ` ``` `-
+ * fence label (feeds shiki syntax-highlighting) and `code` is the
+ * verbatim source. If the primary language is one Fumadocs transforms
+ * on-page (mermaid, mdx), the emitter wraps it in a 4-backtick outer
+ * fence so it renders as literal source instead of a live block.
+ */
+const CANONICAL_SYNTAX: Partial<Record<string, { language: string; code: string }>> = {
+ Callout: {
+ language: 'md',
+ code: `> [!TIP]
+> Pick the type that matches the intent — \`tip\` for advice, \`warning\`
+> for things that can bite, \`note\` for background context.`,
+ },
+ // Accordion also has an HTML5 `<details>`/`<summary>` compat form, but
+ // it can't carry the `icon` / `description` / `title` props the panel
+ // documents. Skip the canonical override so the sample uses the JSX
+ // form and stays in sync with the prop reference.
+ Math: {
+ language: 'md',
+ code: `$$
+E = mc^2
+$$`,
+ },
+ MermaidFence: {
+ language: 'mermaid',
+ code: `graph LR
+ Author((Author)) --> Editor[OK Editor]
+ Editor -- CRDT --> Server[(Hocuspocus)]
+ Server --> Agent{{AI Agent}}
+ Agent --> Editor`,
+ },
+ img: {
+ language: 'md',
+ code: `![A short description](./path/to/image.png)`,
+ },
+ video: {
+ language: 'md',
+ code: `![[demo-clip.mp4]]`,
+ },
+ audio: {
+ language: 'md',
+ code: `![[podcast-episode.mp3]]`,
+ },
+ File: {
+ language: 'md',
+ code: `![[quarterly-report.pdf]]`,
+ },
+ // The auto-generated Mirror example plugs `placeholderFor('src')` into
+ // `src`, which yields an image URL — that contradicts the props table
+ // where `src` is a doc path. Override so the sample reads like the
+ // live preview above it.
+ Mirror: {
+ language: 'mdx',
+ code: `<Mirror src="specs/architecture" anchor="overview-diagram" />`,
+ },
+};
+
+/** Languages Fumadocs remark plugins convert into a live component when
+ * they appear as a top-level fence (mermaid → `<Mermaid>`, mdx →
+ * component). Wrap those in a 4-backtick outer fence so the sample
+ * renders as literal source rather than a duplicate live block. */
+const AUTO_TRANSFORMED_LANGUAGES = new Set(['mermaid', 'mdx']);
+
+/** kebab-case slug for the file name (also the URL segment). */
+function slugOf(name: string): string {
+ // MermaidFence → mermaid-fence; MirrorSource → mirror-source; img stays img.
+ return name
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
+ .toLowerCase();
+}
+
+function typeLabel(prop: PropDef): string {
+ switch (prop.type) {
+ case 'enum':
+ return prop.enumValues.map((v) => `'${v}'`).join(' | ');
+ case 'reactnode':
+ return 'ReactNode';
+ default:
+ return prop.type;
+ }
+}
+
+function escapeMdx(value: string): string {
+ return value.replace(/`/g, '\\`').replace(/\{/g, '\\{').replace(/\}/g, '\\}');
+}
+
+/**
+ * Emit a fenced code block for a sample. Auto-transformed languages get
+ * wrapped in a 4-backtick outer fence so the sample renders as literal
+ * source instead of triggering the corresponding remark plugin (which
+ * would replace the whole block with a live-rendered component alongside
+ * the preview above).
+ */
+function renderCodeSample({ language, code }: { language: string; code: string }): string {
+ if (AUTO_TRANSFORMED_LANGUAGES.has(language)) {
+ return `\`\`\`\`text\n\`\`\`${language}\n${code}\n\`\`\`\n\`\`\`\``;
+ }
+ return `\`\`\`${language}\n${code}\n\`\`\``;
+}
+
+/** Trim a single trailing period so the frontmatter subtitle reads cleanly.
+ * Fumadocs renders the description in a distinct type block; keeping the
+ * terminal punctuation off matches how the other reference pages read. */
+function trimTrailingPeriod(value: string): string {
+ return value.replace(/\.\s*$/, '');
+}
+
+function renderTypeTable(props: PropDef[]): string {
+ const visible = props.filter((p) => !p.hidden);
+ if (visible.length === 0) return '_No public props._';
+ const entries = visible
+ .map((p) => {
+ const description = p.description ? escapeMdx(p.description) : '';
+ const type = typeLabel(p);
+ const defaultLine =
+ 'defaultValue' in p && p.defaultValue !== undefined
+ ? `\n default: ${JSON.stringify(String(p.defaultValue))},`
+ : '';
+ return ` ${JSON.stringify(p.name)}: {\n description: ${JSON.stringify(description)},\n type: ${JSON.stringify(type)},\n required: ${p.required},${defaultLine}\n }`;
+ })
+ .join(',\n');
+ return `<TypeTable\n type={{\n${entries},\n}}\n/>`;
+}
+
+/**
+ * Build a minimal JSX example. For self-closing tags, emit `<Name prop="..." />`
+ * with a couple of representative attrs. For containers, emit an open/close
+ * pair with placeholder body.
+ */
+function renderExample(meta: (typeof builtInComponents)[number]): string {
+ const name = meta.name;
+ // Pick 1-3 non-hidden props to demo — prefer required + enum defaults + a title/src.
+ const publicProps = meta.props.filter((p) => !p.hidden);
+ const featured = [
+ ...publicProps.filter((p) => p.required).slice(0, 3),
+ ...publicProps
+ .filter((p) => !p.required && (p.name === 'title' || p.name === 'src' || p.name === 'type'))
+ .slice(0, 2),
+ ];
+ const seen = new Set<string>();
+ const chosen = featured.filter((p) => {
+ if (seen.has(p.name)) return false;
+ seen.add(p.name);
+ return true;
+ });
+
+ const attrs = chosen
+ .map((p) => {
+ if (p.type === 'boolean') return p.name;
+ if (p.type === 'enum') return `${p.name}="${p.enumValues[0]}"`;
+ if (p.type === 'number') {
+ // Guard against a non-numeric `defaultValue` sneaking in from a
+ // future descriptor — Number.isFinite rejects strings, NaN, and
+ // undefined, so we fall back to `1` instead of emitting invalid
+ // JSX like `width={"foo"}`.
+ const raw = p.defaultValue;
+ const value = typeof raw === 'number' && Number.isFinite(raw) ? raw : 1;
+ return `${p.name}={${value}}`;
+ }
+ if (p.type === 'reactnode') return null;
+ const defaultStr =
+ 'defaultValue' in p && p.defaultValue !== undefined
+ ? String(p.defaultValue)
+ : placeholderFor(p.name);
+ return `${p.name}="${defaultStr}"`;
+ })
+ .filter(Boolean)
+ .join(' ');
+
+ const attrPart = attrs ? ` ${attrs}` : '';
+ if (meta.hasChildren) {
+ const body = meta.exampleBody?.trim() ?? placeholderBody(name);
+ return `<${name}${attrPart}>\n ${body}\n</${name}>`;
+ }
+ return `<${name}${attrPart} />`;
+}
+
+function placeholderFor(propName: string): string {
+ const map: Record<string, string> = {
+ src: 'https://example.com/asset.png',
+ href: 'https://example.com',
+ alt: 'A short description',
+ title: 'Title',
+ formula: 'E = mc^2',
+ chart: 'graph LR; A --> B',
+ id: 'demo-1',
+ name: 'group-a',
+ };
+ return map[propName] ?? '…';
+}
+
+/**
+ * Live preview blocks, keyed by component name. Rendered above the code
+ * example so readers see what the block actually looks like. Every entry
+ * uses the paired `<XPreview>` React component wired in `mdx-components.tsx`;
+ * `Mermaid` reuses the docs-side renderer already registered there.
+ */
+const PREVIEWS: Partial<Record<string, string>> = {
+ Callout: `<ComponentPreview>
+ <CalloutPreview type="tip" title="Ship a good default">
+ Pick the type that matches the intent — <code>tip</code> for advice,
+ <code>warning</code> for things that can bite, <code>note</code> for
+ background context. The icon and accent color track the type automatically.
+ </CalloutPreview>
+</ComponentPreview>`,
+ Accordion: `<ComponentPreview>
+ <AccordionPreview title="Show me the details" description="Click to expand" icon="lucide:BookOpen">
+ Native \`<details>\` under the hood — same substrate as the app render.
+ Pass a shared \`name\` to sibling accordions and the browser will keep
+ only one open at a time.
+ </AccordionPreview>
+</ComponentPreview>`,
+ Tabs: `<ComponentPreview>
+ <TabsPreview>
+ <TabPreview label="Install">
+ Run \`npm install @inkeep/open-knowledge\` to add the CLI to your project.
+ </TabPreview>
+ <TabPreview label="Configure">
+ Point \`.ok/config.yml\` at your content directory. Frontmatter, ignore
+ patterns, and folder defaults all live in this one file.
+ </TabPreview>
+ <TabPreview label="Serve">
+ \`ok start\` boots the collaboration server and opens the editor.
+ </TabPreview>
+ </TabsPreview>
+</ComponentPreview>`,
+ Tab: `<ComponentPreview>
+ <TabsPreview>
+ <TabPreview label="A single Tab">
+ Each <code>&lt;Tab&gt;</code> is one panel of a <code>&lt;Tabs&gt;</code>
+ group. The <code>label</code> becomes the pill at the top; the body
+ renders when the pill is active.
+ </TabPreview>
+ <TabPreview label="Second panel">
+ Switch between panels without losing scroll — the parent tracks which
+ one is active client-side.
+ </TabPreview>
+ </TabsPreview>
+</ComponentPreview>`,
+ Math: `<ComponentPreview>
+ <MathPreview formula="E = mc^2" />
+</ComponentPreview>`,
+ MermaidFence: `<ComponentPreview>
+ <Mermaid chart={\`graph LR
+ Author((Author)) --> Editor[OK Editor]
+ Editor -- CRDT --> Server[(Hocuspocus)]
+ Server --> Agent{{AI Agent}}
+ Agent --> Editor\`} />
+</ComponentPreview>`,
+ img: `<ComponentPreview>
+ <ImgPreview
+ src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=800&q=80"
+ alt="Forest at sunrise"
+ caption="A photo from Unsplash — click to zoom in the app."
+ />
+</ComponentPreview>`,
+ video: `<ComponentPreview>
+ <VideoPreview
+ src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
+ controls
+ />
+</ComponentPreview>`,
+ audio: `<ComponentPreview>
+ <AudioPreview
+ src="https://actions.google.com/sounds/v1/alarms/beep_short.ogg"
+ controls
+ />
+</ComponentPreview>`,
+ Pdf: `<ComponentPreview>
+ <PdfPreview src="https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf" />
+</ComponentPreview>`,
+ File: `<ComponentPreview>
+ <FilePreview name="quarterly-report.pdf" size="124 KB" />
+</ComponentPreview>`,
+ Embed: `<ComponentPreview>
+ <EmbedPreview
+ src="https://openknowledge.ai/"
+ title="OpenKnowledge marketing site"
+ />
+</ComponentPreview>`,
+ Mirror: `<ComponentPreview>
+ <MirrorPreview src="specs/architecture" anchor="overview-diagram">
+ This body renders live from wherever the \`<MirrorSource id="overview-diagram">\`
+ with a matching id lives — edits there ripple here without a copy step.
+ </MirrorPreview>
+</ComponentPreview>`,
+ MirrorSource: `<ComponentPreview>
+ <MirrorSourcePreview id="overview-diagram">
+ The canonical content this block owns. Every \`<Mirror>\` that references
+ this id anywhere in the project reads from here.
+ </MirrorSourcePreview>
+</ComponentPreview>`,
+};
+
+function placeholderBody(name: string): string {
+ if (name === 'Tabs')
+ return '<Tab label="First">First panel</Tab>\n <Tab label="Second">Second panel</Tab>';
+ if (name === 'Tab') return 'Panel body content.';
+ if (name === 'Accordion') return 'Body content — hidden until the summary is clicked.';
+ if (name === 'Callout') return 'Content of the callout goes here.';
+ if (name === 'MirrorSource') return 'The canonical content this block owns.';
+ return 'Content goes here.';
+}
+
+function renderPage(
+ meta: (typeof builtInComponents)[number],
+ byName: Map<string, (typeof builtInComponents)[number]>,
+): string {
+ const title = meta.displayName ?? meta.name;
+ const rawDescription = meta.description ?? `${title} component`;
+ const frontmatterDescription = trimTrailingPeriod(rawDescription);
+ const keywords = meta.searchTerms?.slice(0, 12).join(', ') ?? '';
+ const example = renderExample(meta);
+ const propsTable = renderTypeTable(meta.props);
+ const searchTermsLine = meta.searchTerms?.length
+ ? // No trailing period after the last inline-code chip — the space before
+ // `.` renders as a distracting dangling dot next to the last chip.
+ `_Also matches:_ ${meta.searchTerms.map((t) => `\`${t}\``).join(', ')}\n\n`
+ : '';
+
+ const preview = PREVIEWS[meta.name];
+ const previewBlock = preview ? `${preview}\n\n` : '';
+
+ const childName = COMPOSITION_CHILDREN[meta.name];
+ const childMeta = childName ? byName.get(childName) : undefined;
+ const childBlock = childMeta ? renderChildSection(childMeta) : '';
+
+ const canonical = CANONICAL_SYNTAX[meta.name];
+ const codeSample = canonical ? renderCodeSample(canonical) : `\`\`\`mdx\n${example}\n\`\`\``;
+
+ return `---
+title: ${JSON.stringify(title)}
+description: ${JSON.stringify(frontmatterDescription)}${keywords ? `\nkeywords: ${JSON.stringify(keywords)}` : ''}
+---
+
+## Example
+
+${previewBlock}${codeSample}
+
+## Props
+
+${propsTable}
+
+${childBlock}${searchTermsLine}## Author it
+
+Type \`/${(meta.searchTerms?.[0] ?? meta.name).toLowerCase()}\` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.
+`;
+}
+
+/**
+ * Render the composition-child section appended to the parent's page —
+ * `Tab` under `Tabs`, `MirrorSource` under `Mirror`. Same shape as a
+ * standalone page: description + optional preview + code example +
+ * TypeTable, but without frontmatter or an "Author it" trailer since
+ * the parent's covers it.
+ */
+function renderChildSection(child: (typeof builtInComponents)[number]): string {
+ const title = child.displayName ?? child.name;
+ const rawDescription = child.description ?? `${title} component`;
+ const description = `${trimTrailingPeriod(rawDescription)}.`;
+ const example = renderExample(child);
+ const propsTable = renderTypeTable(child.props);
+ const preview = PREVIEWS[child.name];
+ const previewBlock = preview ? `${preview}\n\n` : '';
+ return `## Also: \`<${child.name}>\`
+
+${description}
+
+${previewBlock}\`\`\`mdx
+${example}
+\`\`\`
+
+${propsTable}
+
+`;
+}
+
+async function main() {
+ await mkdir(OUT_DIR, { recursive: true });
+
+ const canonical = builtInComponents.filter((c) => c.surface === 'canonical' && c.name !== '*');
+ const byName = new Map(canonical.map((c) => [c.name, c] as const));
+
+ const pagesInOrder: string[] = [];
+ for (const name of PAGE_ORDER) {
+ const meta = byName.get(name);
+ if (!meta) {
+ console.warn(
+ `[generate-component-docs] canonical name "${name}" not found in registry — skipping`,
+ );
+ continue;
+ }
+ const slug = slugOf(name);
+ const filePath = path.join(OUT_DIR, `${slug}.mdx`);
+ await writeFile(filePath, renderPage(meta, byName));
+ pagesInOrder.push(slug);
+ console.log(`wrote ${path.relative(process.cwd(), filePath)}`);
+ }
+
+ // Any canonical component not in PAGE_ORDER — append at the end so a new
+ // registry addition can't silently drop off the sidebar. Composition
+ // children (Tab, MirrorSource) are folded into their parents' pages
+ // above, so intentionally skipped here.
+ for (const meta of canonical) {
+ if ((PAGE_ORDER as readonly string[]).includes(meta.name)) continue;
+ if (COMPOSITION_CHILD_NAMES.has(meta.name)) continue;
+ const slug = slugOf(meta.name);
+ const filePath = path.join(OUT_DIR, `${slug}.mdx`);
+ await writeFile(filePath, renderPage(meta, byName));
+ pagesInOrder.push(slug);
+ console.warn(
+ `[generate-component-docs] canonical "${meta.name}" is not in PAGE_ORDER — appended at end`,
+ );
+ }
+
+ const meta = {
+ title: 'Components',
+ icon: 'LuBlocks',
+ pages: ['index', ...pagesInOrder],
+ };
+ await writeFile(path.join(OUT_DIR, 'meta.json'), `${JSON.stringify(meta, null, 2)}\n`);
+ console.log(`wrote ${path.relative(process.cwd(), path.join(OUT_DIR, 'meta.json'))}`);
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/docs/src/components/component-preview.tsx b/docs/src/components/component-preview.tsx
new file mode 100644
index 000000000..40365439c
--- /dev/null
+++ b/docs/src/components/component-preview.tsx
@@ -0,0 +1,18 @@
+import type { ReactNode } from 'react';
+
+/**
+ * Wrapper for a live block-component demo on a component reference page.
+ * Renders the child preview inside a labeled bordered container so the
+ * reader sees "this is what shows up when you author it" rather than
+ * mistaking the demo for surrounding docs prose.
+ */
+export function ComponentPreview({ children }: { children: ReactNode }) {
+ return (
+ <div className="not-prose my-6 rounded-lg border border-fd-border bg-fd-card">
+ <div className="border-fd-border border-b px-4 py-2 text-fd-muted-foreground text-xs uppercase tracking-wide">
+ Preview
+ </div>
+ <div className="p-6">{children}</div>
+ </div>
+ );
+}
diff --git a/docs/src/components/previews/accordion-preview.tsx b/docs/src/components/previews/accordion-preview.tsx
new file mode 100644
index 000000000..fbc0f0bc8
--- /dev/null
+++ b/docs/src/components/previews/accordion-preview.tsx
@@ -0,0 +1,52 @@
+import { ChevronDown, type LucideIcon } from 'lucide-react';
+import type { ReactNode } from 'react';
+import { resolveLucideIcon } from './lucide-lookup';
+
+/**
+ * Preview clone of the app `Accordion`. Native HTML5 `<details>` — same
+ * substrate as the app render, minus the editor-scoped CSS. Optional
+ * `name` groups sibling accordions (browser-native exclusive open) so
+ * demo blocks that share a `name` auto-close each other.
+ */
+export function AccordionPreview({
+ title,
+ defaultOpen,
+ description,
+ icon,
+ name,
+ children,
+}: {
+ title: string;
+ defaultOpen?: boolean;
+ description?: string;
+ icon?: string;
+ name?: string;
+ children?: ReactNode;
+}) {
+ const Icon: LucideIcon | null = icon ? (resolveLucideIcon(icon) ?? null) : null;
+ return (
+ <details
+ className="group rounded-md border border-fd-border bg-fd-card/50"
+ open={defaultOpen}
+ name={name}
+ >
+ <summary className="flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm text-fd-foreground [&::-webkit-details-marker]:hidden">
+ {Icon ? <Icon size={16} className="text-fd-muted-foreground" aria-hidden /> : null}
+ <span className="flex-1">
+ <span className="font-medium">{title}</span>
+ {description ? (
+ <span className="ml-2 text-fd-muted-foreground text-xs">{description}</span>
+ ) : null}
+ </span>
+ <ChevronDown
+ size={16}
+ className="text-fd-muted-foreground transition-transform group-open:rotate-180"
+ aria-hidden
+ />
+ </summary>
+ <div className="border-fd-border border-t px-4 py-3 text-fd-foreground text-sm">
+ {children}
+ </div>
+ </details>
+ );
+}
diff --git a/docs/src/components/previews/callout-preview.tsx b/docs/src/components/previews/callout-preview.tsx
new file mode 100644
index 000000000..e24e8b00d
--- /dev/null
+++ b/docs/src/components/previews/callout-preview.tsx
@@ -0,0 +1,138 @@
+import {
+ AlertOctagon,
+ AlertTriangle,
+ BookOpen,
+ Bug,
+ ChevronDown,
+ CircleCheck,
+ CircleHelp,
+ CircleX,
+ ClipboardList,
+ FlaskConical,
+ Info,
+ Lightbulb,
+ ListTodo,
+ type LucideIcon,
+ MessageSquareWarning,
+ Quote,
+ Zap,
+} from 'lucide-react';
+import type { ReactNode } from 'react';
+
+/**
+ * Preview clone of the app's `Callout` render for the docs. Same 15-type
+ * enum, same title/icon/color/collapsible surface. Visual shape mirrors
+ * `packages/app/src/editor/components/Callout.tsx` — the app's live version
+ * is styled through `packages/app/src/globals.css` (`.callout-*` classes
+ * + `--callout-type-color` accent variables); this preview inlines the
+ * same accent + layout using Tailwind so the docs render standalone and
+ * don't have to ship the editor CSS bundle.
+ */
+type CalloutType =
+ | 'note'
+ | 'tip'
+ | 'important'
+ | 'warning'
+ | 'caution'
+ | 'abstract'
+ | 'info'
+ | 'todo'
+ | 'success'
+ | 'question'
+ | 'failure'
+ | 'danger'
+ | 'bug'
+ | 'example'
+ | 'quote';
+
+const TYPE_ICON: Record<CalloutType, LucideIcon> = {
+ note: Info,
+ tip: Lightbulb,
+ important: MessageSquareWarning,
+ warning: AlertTriangle,
+ caution: AlertOctagon,
+ abstract: ClipboardList,
+ info: BookOpen,
+ todo: ListTodo,
+ success: CircleCheck,
+ question: CircleHelp,
+ failure: CircleX,
+ danger: Zap,
+ bug: Bug,
+ example: FlaskConical,
+ quote: Quote,
+};
+
+// Accent hex per type — kept in sync with the `--callout-*-color` custom
+// props defined in `packages/app/src/globals.css`. Sync manually on refresh.
+const TYPE_COLOR: Record<CalloutType, string> = {
+ note: '#3b82f6',
+ tip: '#22c55e',
+ important: '#a855f7',
+ warning: '#f59e0b',
+ caution: '#ef4444',
+ abstract: '#0ea5e9',
+ info: '#3b82f6',
+ todo: '#6366f1',
+ success: '#22c55e',
+ question: '#eab308',
+ failure: '#ef4444',
+ danger: '#dc2626',
+ bug: '#f97316',
+ example: '#8b5cf6',
+ quote: '#94a3b8',
+};
+
+interface CalloutPreviewProps {
+ type?: CalloutType;
+ title?: string;
+ color?: string;
+ collapsible?: boolean;
+ defaultOpen?: boolean;
+ children?: ReactNode;
+}
+
+export function CalloutPreview({
+ type = 'note',
+ title,
+ color,
+ collapsible = false,
+ defaultOpen = true,
+ children,
+}: CalloutPreviewProps) {
+ const Icon = TYPE_ICON[type];
+ const accent = color ?? TYPE_COLOR[type];
+
+ const rootStyle = { borderLeftColor: accent };
+ // Callout container — thick left accent border matches the app render.
+ const rootClass =
+ 'flex gap-3 rounded-md border border-fd-border border-l-4 bg-fd-card/50 px-4 py-3 text-sm text-fd-foreground';
+ const iconStyle = { color: accent };
+ const header = (
+ <span className="flex items-center gap-2">
+ <Icon size={16} style={iconStyle} aria-hidden />
+ {title ? <span className="font-medium">{title}</span> : null}
+ </span>
+ );
+
+ if (collapsible) {
+ return (
+ <details className={rootClass} style={rootStyle} open={defaultOpen}>
+ <summary className="flex cursor-pointer list-none items-center justify-between gap-2 [&::-webkit-details-marker]:hidden">
+ {header ?? <span className="font-medium">Details</span>}
+ <ChevronDown size={16} className="text-fd-muted-foreground" aria-hidden />
+ </summary>
+ <div className="mt-2 flex flex-col gap-2 pl-6">{children}</div>
+ </details>
+ );
+ }
+
+ return (
+ <div className={rootClass} style={rootStyle}>
+ <div className="flex flex-col gap-2">
+ {header}
+ <div className="flex flex-col gap-2">{children}</div>
+ </div>
+ </div>
+ );
+}
diff --git a/docs/src/components/previews/file-preview.tsx b/docs/src/components/previews/file-preview.tsx
new file mode 100644
index 000000000..5c9aa5949
--- /dev/null
+++ b/docs/src/components/previews/file-preview.tsx
@@ -0,0 +1,28 @@
+import { FileUp } from 'lucide-react';
+
+/**
+ * Preview clone of the app `File` — inline Notion-style attachment row.
+ * `size` is a raw human string ("124 KB") since the app takes a
+ * pre-formatted `size` prop off the descriptor. `href` is optional; when
+ * absent the row renders as a plain span so demo cards don't drive
+ * navigation.
+ */
+export function FilePreview({ name, size, href }: { name: string; size?: string; href?: string }) {
+ const inner = (
+ <>
+ <FileUp size={16} className="text-fd-muted-foreground" aria-hidden />
+ <span className="flex-1 font-medium">{name}</span>
+ {size ? <span className="text-fd-muted-foreground text-xs">{size}</span> : null}
+ </>
+ );
+ const rootClass =
+ 'inline-flex w-full items-center gap-2 rounded-md border border-fd-border bg-fd-card/50 px-3 py-2 text-fd-foreground text-sm';
+ if (href) {
+ return (
+ <a href={href} className={rootClass}>
+ {inner}
+ </a>
+ );
+ }
+ return <span className={rootClass}>{inner}</span>;
+}
diff --git a/docs/src/components/previews/lucide-lookup.ts b/docs/src/components/previews/lucide-lookup.ts
new file mode 100644
index 000000000..bfb8e2b20
--- /dev/null
+++ b/docs/src/components/previews/lucide-lookup.ts
@@ -0,0 +1,21 @@
+import type { LucideIcon } from 'lucide-react';
+import * as lucide from 'lucide-react';
+
+/**
+ * Resolve a namespaced lucide identifier (`lucide:Lightbulb`) to the actual
+ * component — same interface the app uses for `<Callout icon="...">` /
+ * `<Accordion icon="...">`. Undefined for anything not in the lucide export
+ * map so callers can fall back to a type-derived default.
+ */
+export function resolveLucideIcon(identifier: string | undefined): LucideIcon | undefined {
+ if (!identifier) return undefined;
+ const parts = identifier.split(':');
+ const name = (parts[1] ?? parts[0]).trim();
+ if (!name) return undefined;
+ const table = lucide as unknown as Record<string, unknown>;
+ const candidate = table[name];
+ if (typeof candidate === 'function' || (candidate && typeof candidate === 'object')) {
+ return candidate as LucideIcon;
+ }
+ return undefined;
+}
diff --git a/docs/src/components/previews/math-preview.tsx b/docs/src/components/previews/math-preview.tsx
new file mode 100644
index 000000000..fa805684b
--- /dev/null
+++ b/docs/src/components/previews/math-preview.tsx
@@ -0,0 +1,30 @@
+'use client';
+
+import 'katex/dist/katex.min.css';
+import katex from 'katex';
+
+/**
+ * Preview of the app `Math` — KaTeX rendered from a LaTeX source string.
+ * Uses the same underlying library as the app render (`katex`), just
+ * without the editor's block-selection chrome. Renders in block mode by
+ * default so the demo reads at a comfortable size.
+ */
+export function MathPreview({ formula, display = true }: { formula: string; display?: boolean }) {
+ const html = renderFormula(formula, display);
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: katex output is trusted
+ return <div className="text-fd-foreground" dangerouslySetInnerHTML={{ __html: html }} />;
+}
+
+/** Render inline — React Compiler handles memoization; per CLAUDE.md the
+ * project bans manual `useMemo` / `useCallback`. */
+function renderFormula(formula: string, display: boolean): string {
+ try {
+ return katex.renderToString(formula, {
+ displayMode: display,
+ throwOnError: false,
+ output: 'html',
+ });
+ } catch (err) {
+ return `<span style="color:tomato">${(err as Error)?.message ?? 'Failed to render'}</span>`;
+ }
+}
diff --git a/docs/src/components/previews/media-previews.tsx b/docs/src/components/previews/media-previews.tsx
new file mode 100644
index 000000000..ae4fca7c9
--- /dev/null
+++ b/docs/src/components/previews/media-previews.tsx
@@ -0,0 +1,129 @@
+/**
+ * Trivial previews for the media canonicals — `img`, `video`, `audio`,
+ * `Pdf`, `Embed`. Each renders the native HTML element the app uses,
+ * matching the app render's zero-chrome default. `Pdf` reuses a public
+ * pdfjs-hosted document so the multi-page viewer is real.
+ */
+
+interface ImgPreviewProps {
+ src: string;
+ alt?: string;
+ width?: number;
+ height?: number;
+ caption?: string;
+}
+
+export function ImgPreview({
+ src,
+ alt = 'Preview image',
+ width,
+ height,
+ caption,
+}: ImgPreviewProps) {
+ return (
+ <figure className="m-0 flex flex-col items-start gap-2">
+ {/* biome-ignore lint/performance/noImgElement: docs demo mirrors the app's raw <img>; next/image would require domain allowlisting for every third-party demo URL. */}
+ <img src={src} alt={alt} width={width} height={height} className="max-w-full rounded-md" />
+ {caption ? (
+ <figcaption className="text-fd-muted-foreground text-xs">{caption}</figcaption>
+ ) : null}
+ </figure>
+ );
+}
+
+interface VideoPreviewProps {
+ src: string;
+ controls?: boolean;
+ autoPlay?: boolean;
+ loop?: boolean;
+ muted?: boolean;
+ width?: number;
+ height?: number;
+}
+
+export function VideoPreview({
+ src,
+ controls = true,
+ autoPlay,
+ loop,
+ muted,
+ width,
+ height,
+}: VideoPreviewProps) {
+ // No `<track>` child — a captionless <track> without src is invalid
+ // and some browsers throw on it. Docs demos never need captions.
+ return (
+ <video
+ src={src}
+ controls={controls}
+ autoPlay={autoPlay}
+ loop={loop}
+ muted={muted}
+ width={width}
+ height={height}
+ className="max-w-full rounded-md"
+ preload="metadata"
+ >
+ <p>Your browser doesn't support HTML5 video.</p>
+ </video>
+ );
+}
+
+interface AudioPreviewProps {
+ src: string;
+ controls?: boolean;
+ autoPlay?: boolean;
+ loop?: boolean;
+}
+
+export function AudioPreview({ src, controls = true, autoPlay, loop }: AudioPreviewProps) {
+ return (
+ // biome-ignore lint/a11y/useMediaCaption: docs demo clip has no caption track available; the app's <audio> render also passes through raw HTML attributes.
+ <audio src={src} controls={controls} autoPlay={autoPlay} loop={loop} className="w-full">
+ <p>Your browser doesn't support HTML5 audio.</p>
+ </audio>
+ );
+}
+
+/**
+ * PDF preview via `<iframe>` — the app's `Pdf` uses pdfjs-dist for a
+ * proper multi-page canvas viewer. Getting pdfjs to run in a docs context
+ * requires shipping the worker bundle; the iframe shortcut is honest to
+ * the "embedded PDF" idea without dragging pdfjs into the docs build.
+ */
+export function PdfPreview({ src, height = 480 }: { src: string; height?: number }) {
+ return (
+ <iframe
+ src={src}
+ title="PDF preview"
+ className="w-full rounded-md border border-fd-border"
+ style={{ height }}
+ />
+ );
+}
+
+/**
+ * Generic sandboxed iframe embed. Same defaults as the app render:
+ * `referrerpolicy="no-referrer"` + minimal sandbox that allows scripts,
+ * same-origin, and popups needed for e.g. CodeSandbox demos.
+ */
+export function EmbedPreview({
+ src,
+ height = 400,
+ title = 'Embedded content',
+}: {
+ src: string;
+ height?: number;
+ title?: string;
+}) {
+ return (
+ <iframe
+ src={src}
+ title={title}
+ referrerPolicy="no-referrer"
+ sandbox="allow-scripts allow-same-origin allow-popups"
+ className="w-full rounded-md border border-fd-border"
+ style={{ height }}
+ />
+ );
+}
diff --git a/docs/src/components/previews/mirror-previews.tsx b/docs/src/components/previews/mirror-previews.tsx
new file mode 100644
index 000000000..e759d2cd9
--- /dev/null
+++ b/docs/src/components/previews/mirror-previews.tsx
@@ -0,0 +1,47 @@
+import { Copy, Link } from 'lucide-react';
+import type { ReactNode } from 'react';
+
+/**
+ * Preview clones for `Mirror` and `MirrorSource`. The app implementations
+ * plug into the CRDT provider pool to project a `<MirrorSource id="x">`
+ * from one doc into every `<Mirror sourceId="x">` elsewhere — impossible
+ * to boot in a standalone docs page. These previews render the same
+ * visual chrome (source badge, "read-only" indicator) so authors can
+ * see the shape without wiring up transclusion for a demo.
+ */
+
+export function MirrorSourcePreview({ id, children }: { id: string; children?: ReactNode }) {
+ return (
+ <div className="rounded-md border border-fd-border border-l-4 border-l-fd-primary bg-fd-card/50 px-4 py-3 text-fd-foreground text-sm">
+ <div className="mb-2 flex items-center gap-2 text-fd-muted-foreground text-xs">
+ <Copy size={12} aria-hidden />
+ <span className="font-mono">source id={id}</span>
+ </div>
+ <div className="flex flex-col gap-2">{children}</div>
+ </div>
+ );
+}
+
+export function MirrorPreview({
+ src,
+ anchor,
+ children,
+}: {
+ src: string;
+ anchor: string;
+ children?: ReactNode;
+}) {
+ return (
+ <div className="rounded-md border border-fd-border border-l-4 border-l-fd-muted-foreground/40 bg-fd-muted/30 px-4 py-3 text-fd-foreground text-sm">
+ <div className="mb-2 flex items-center gap-2 text-fd-muted-foreground text-xs">
+ <Link size={12} aria-hidden />
+ <span>
+ Mirror of <span className="font-mono">{src}</span>
+ {' → '}
+ <span className="font-mono">#{anchor}</span> — read-only
+ </span>
+ </div>
+ <div className="flex flex-col gap-2 opacity-90">{children}</div>
+ </div>
+ );
+}
diff --git a/docs/src/components/previews/tabs-preview.tsx b/docs/src/components/previews/tabs-preview.tsx
new file mode 100644
index 000000000..3eb32d3be
--- /dev/null
+++ b/docs/src/components/previews/tabs-preview.tsx
@@ -0,0 +1,60 @@
+'use client';
+
+import { Children, isValidElement, type ReactNode, useState } from 'react';
+
+/**
+ * Individual tab panel. Passes its `label` up to the parent
+ * `<TabsPreview>` via props inspection — the parent maps every child
+ * element into a `(label, body)` pair. No identity comparison, so this
+ * works across the server → client boundary MDX pages cross.
+ */
+export function TabPreview({ children }: { label: string; children?: ReactNode }) {
+ return <>{children}</>;
+}
+
+export function TabsPreview({ children }: { children?: ReactNode }) {
+ // Every element child is treated as a `<TabPreview>` — text-node
+ // whitespace between MDX tags is dropped. Read the label directly off
+ // props so we don't have to compare against the client-side
+ // `TabPreview` reference (which is a different object in server
+ // context).
+ const tabs = Children.toArray(children)
+ .filter(isValidElement)
+ .map((child) => {
+ const props = (child as { props: { label?: string; children?: ReactNode } }).props;
+ return { label: props.label ?? '', body: props.children };
+ })
+ .filter((tab) => tab.label.length > 0);
+ const [active, setActive] = useState(0);
+ if (tabs.length === 0) return null;
+ const current = tabs[Math.min(active, tabs.length - 1)];
+
+ return (
+ <div className="w-full">
+ <div className="mb-3 flex gap-1 border-fd-border border-b" role="tablist">
+ {tabs.map((tab, i) => {
+ const isActive = i === active;
+ return (
+ <button
+ key={tab.label}
+ type="button"
+ role="tab"
+ aria-selected={isActive}
+ onClick={() => setActive(i)}
+ className={
+ isActive
+ ? '-mb-px border-fd-primary border-b-2 px-3 py-1.5 text-fd-foreground text-sm'
+ : '-mb-px border-b-2 border-transparent px-3 py-1.5 text-fd-muted-foreground text-sm hover:text-fd-foreground'
+ }
+ >
+ {tab.label}
+ </button>
+ );
+ })}
+ </div>
+ <div role="tabpanel" className="text-fd-foreground text-sm">
+ {current.body}
+ </div>
+ </div>
+ );
+}
diff --git a/docs/src/mdx-components.tsx b/docs/src/mdx-components.tsx
index 5defc12bd..fe911a2af 100644
--- a/docs/src/mdx-components.tsx
+++ b/docs/src/mdx-components.tsx
@@ -6,6 +6,7 @@ import { TypeTable } from 'fumadocs-ui/components/type-table';
import defaultMdxComponents from 'fumadocs-ui/mdx';
import type { MDXComponents } from 'mdx/types';
import { AgentIcons } from '@/components/agent-icons';
+import { ComponentPreview } from '@/components/component-preview';
import { CopyPrompt } from '@/components/copy-prompt';
import { CtaButton } from '@/components/cta-button';
import { DownloadButton } from '@/components/download-button';
@@ -13,6 +14,19 @@ import { HtmlPreview } from '@/components/html-preview';
import { McpInstall } from '@/components/mcp-install';
import { Mermaid } from '@/components/mermaid';
import { LayerStack, WhereToStart } from '@/components/overview-blocks';
+import { AccordionPreview } from '@/components/previews/accordion-preview';
+import { CalloutPreview } from '@/components/previews/callout-preview';
+import { FilePreview } from '@/components/previews/file-preview';
+import { MathPreview } from '@/components/previews/math-preview';
+import {
+ AudioPreview,
+ EmbedPreview,
+ ImgPreview,
+ PdfPreview,
+ VideoPreview,
+} from '@/components/previews/media-previews';
+import { MirrorPreview, MirrorSourcePreview } from '@/components/previews/mirror-previews';
+import { TabPreview, TabsPreview } from '@/components/previews/tabs-preview';
import { Tab, Tabs } from '@/components/tabs';
import { VerifyExec } from '@/components/verify-exec';
@@ -20,23 +34,37 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {
...defaultMdxComponents,
Accordion,
+ AccordionPreview,
Accordions,
AgentIcons,
+ AudioPreview,
+ CalloutPreview,
Card,
Cards,
+ ComponentPreview,
CopyPrompt,
CtaButton,
DownloadButton,
+ EmbedPreview,
+ FilePreview,
HtmlPreview,
Image: ImageZoom,
+ ImgPreview,
LayerStack,
+ MathPreview,
McpInstall,
Mermaid,
+ MirrorPreview,
+ MirrorSourcePreview,
+ PdfPreview,
Step,
Steps,
WhereToStart,
Tab,
+ TabPreview,
Tabs,
+ TabsPreview,
+ VideoPreview,
TypeTable,
VerifyExec,
...components,
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index 8f9d95287..c014b1413 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,4 +1,3 @@
-
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 8bfdb40cd..005627195 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,4 +1,3 @@
-
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index c18c086d5..8890f6739 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,4 +1,3 @@
-
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
const LEADING_BOUNDARY_RE = /^(?:\r?\n)+/;
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index 864bc7245..b0a80fbd9 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -37,7 +37,6 @@ function mergeThreeWayImpl(baseline: string, userText: string, agentText: string
return parts.join('\n');
}
-
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index 592f0b956..e67f33b40 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,4 +1,3 @@
-
const COMMONMARK_ESCAPE_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g;
const TABLE_ALIGN_ROW_RE = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/;
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index a363dfd54..83d47404a 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,4 +1,3 @@
-
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 47f0d07e4..193e286b0 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index b6299a948..ece5c02a1 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,4 +1,3 @@
-
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index acd398aa6..54774764a 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index fb5ac8e8a..c7518d614 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,4 +1,3 @@
-
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 6931623c7..00f5771ee 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,4 +1,3 @@
-
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
-
interface GfmExample {
section: string;
markdown: string;
@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
-
interface MdxCrashEntry {
id: string;
input: string;
@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
-
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
-
export interface NgPinnedCase {
id: string;
name: string;
@@ -97,7 +92,6 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
-
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index daa3ef82b..8b1eb8519 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,4 +1,3 @@
-
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
-
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
-
const WORDS = [
'lorem',
'ipsum',
@@ -156,7 +153,6 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
-
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -195,7 +191,6 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
-
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 32c055c5b..420dc0fe5 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,7 +7,6 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
-
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 283913255..2653473da 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,4 +1,3 @@
-
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index 7a22e8016..f758cf737 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 2f082e6d0..78fdfeb02 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,4 +1,3 @@
-
import type { Root as HastRoot } from 'hast';
import type { Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -76,8 +75,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified()
- .use(rehypeParse, { fragment: true });
+ const processor = unified().use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 994eb6917..706fa9afb 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index 064fa0773..58a810193 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -165,7 +164,6 @@ export class MarkdownManager {
}
}
-
const registry = createRegistry();
function destructureAttrs(
@@ -214,7 +212,6 @@ function destructureAttrs(
return result;
}
-
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -233,7 +230,6 @@ function effectiveDirty(node: PmNode): boolean {
return node.attrs.sourceDirty || hasDirtyDescendant(node);
}
-
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -302,7 +298,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
-
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -552,7 +547,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -632,7 +626,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -911,7 +904,6 @@ function buildMdastToPmHandlers(
};
}
-
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1037,7 +1029,6 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
-
function buildPmToMdastHandlers(schema: Schema): {
nodeHandlers: FromProseMirrorOptions<string, string>['nodeHandlers'];
markHandlers: FromProseMirrorOptions<string, string>['markHandlers'];
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index bd79424c7..a5b511f25 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index f84967798..679c72ef7 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index df788a80d..8ce2b2492 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index a58f8c720..35d74b85e 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 17ed2b829..1a897fca8 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index 7e4a9a48b..9864b3b60 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,7 +168,6 @@ export function parseRecursive(
}
}
-
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
-
interface Region {
start: number;
end: number;
@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
-
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
-
interface SourceBlock {
src: string;
start: number;
@@ -456,7 +452,6 @@ function tryPerBlockFallback(
};
}
-
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index 43d420187..e6ab4fd57 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,4 +1,3 @@
-
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 5b9550e90..5d6db7aa8 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index 4ac5731e7..248685cfe 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,4 +1,3 @@
-
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index 240be90e6..50a193a16 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -467,8 +466,7 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- }
- else if (first === '[') {
+ } else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index ca225ce9b..db10fa54b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 3a2524a9a..34068d103 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 2279a0189..93151d43b 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index a0f467c42..188f02d83 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4e8542a21..4ba2c3418 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index a3c96b24a..1a74b1272 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index e95cf43d6..de35e7b79 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index ffdb4d5b5..b4be1b2ea 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index e2a96d1a7..3c8d88b7c 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index 0389575ac..cf2c9da8e 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,4 +1,3 @@
-
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 8be632ba4..4d3250d3a 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,4 +1,3 @@
-
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 542204403..46cc6a074 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,4 +1,3 @@
-
import type { Node as PmNode } from '@tiptap/pm/model';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { PropDef, SerializeContext } from '../registry/types.ts';
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index fe73659e6..be97d4d62 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index e1161455b..1a2fb5d50 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index c5bfd2386..cd245c38c 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,4 +1,3 @@
-
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index 1b75ba564..a100cad76 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,4 +1,3 @@
-
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index afd9936fe..6dad26200 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {
}
}
-
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {
};
}
-
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
-
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {