docs
Symbol
Code construct documentation for functions, classes, interfaces, enums, and type aliases
Install
- Add the package:
npm install @refrakt-md/docs - Add it to the
pluginsarray inrefrakt.config.json:"plugins": ["@refrakt-md/docs"]
Source
import Markdoc from '@markdoc/markdoc';
import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
const { Ast, Tag } = Markdoc;
import {
createContentModelSchema,
bodyOnly,
createComponentRenderable,
asNodes,
renderNodes,
resolveSequence,
RenderableNodeCursor,
pageSectionProperties,
headingsToList,
unwrapParagraphImages,
} from '@refrakt-md/runes';
const GROUP_KINDS = ['class', 'interface', 'module'];
export const symbolMember = createContentModelSchema({
attributes: {},
contentModel: bodyOnly(),
transform(resolved, _attrs, config) {
const children = renderNodes(resolved.body, config);
const nameHeading = children.headings().limit(1);
const hasName = nameHeading.count() > 0;
const nameTag = new Tag('h4', {}, hasName ? nameHeading.next().children : []);
const body = children.slice(hasName ? 1 : 0).wrap('div');
return createComponentRenderable({
rune: 'symbol-member',
tag: 'section',
refs: {
name: nameTag,
body: body.tag('div'),
},
children: [nameTag, body.next()],
});
},
});
export const symbolGroup = createContentModelSchema({
attributes: {},
contentModel: {
type: 'custom',
description:
"A level-3 (###) heading becomes the group label. Each level-4 (####) heading starts a new symbol-member entry — the heading text is the member name, and content between headings (paragraphs, fences, lists) becomes that member's body.",
processChildren(nodes) {
const level = 4;
const converted = headingsToList({ level })(nodes as Node[]);
const n = converted.length - 1;
if (!converted[n] || converted[n].type !== 'list') return nodes;
const tags = converted[n].children.map((item) => {
return new Ast.Node('tag', {}, item.children, 'symbol-member');
});
converted.splice(n, 1, ...tags);
return converted;
},
},
transform(resolved, _attrs, config) {
const children = new RenderableNodeCursor(
Markdoc.transform(resolved.children as Node[], config) as RenderableTreeNode[],
);
const labelHeading = children.headings().limit(1);
const hasLabel = labelHeading.count() > 0;
const labelTag = new Tag('h3', {}, hasLabel ? labelHeading.next().children : []);
const body = children.slice(hasLabel ? 1 : 0).wrap('div');
return createComponentRenderable({
rune: 'symbol-group',
tag: 'section',
refs: {
label: labelTag,
body: body.tag('div'),
},
children: [labelTag, body.next()],
});
},
});
const headerBodyFields = [
{ name: 'header', match: 'heading|paragraph|image' as const, greedy: true, optional: true },
{
name: 'body',
match: 'heading|paragraph|fence|list|blockquote|tag|hr|table' as const,
greedy: true,
optional: true,
},
];
export const symbolSections = { preamble: 'preamble', headline: 'title', body: 'body' } as const;
export const symbolSchema = {
type: 'TechArticle',
properties: { headline: 'name', blurb: 'description' },
} as const;
export const symbol = createContentModelSchema({
schema: symbolSchema,
sections: symbolSections,
attributes: {
kind: {
type: String,
required: false,
matches: ['function', 'class', 'interface', 'enum', 'type', 'module', 'hook', 'component'],
default: 'function',
description: 'Symbol category that controls grouping behavior and icon display.',
},
lang: {
type: String,
required: false,
default: 'typescript',
description: 'Programming language used for syntax highlighting in code examples.',
},
since: {
type: String,
required: false,
default: '',
description: 'Version when this symbol was introduced (e.g. "1.2.0").',
},
deprecated: {
type: String,
required: false,
default: '',
description: 'Deprecation notice with version or reason; leave empty if not deprecated.',
},
source: {
type: String,
required: false,
default: '',
description: 'URL to the source file or repository for this symbol.',
},
},
contentModel: (attrs) => {
if (GROUP_KINDS.includes(attrs.kind as string)) {
return {
type: 'custom' as const,
description:
'For class, interface, and module kinds: any content before the first level-3 (###) heading becomes the symbol header. Each level-3 heading starts a new symbol-group, which may contain nested level-4 (####) symbol members.',
processChildren(nodes: unknown[]) {
const converted = headingsToList({ level: 3 })(nodes as Node[]);
const n = converted.length - 1;
if (!converted[n] || converted[n].type !== 'list') return nodes;
const tags = converted[n].children.map((item) => {
return new Ast.Node('tag', {}, item.children, 'symbol-group');
});
converted.splice(n, 1, ...tags);
return converted;
},
};
}
return {
type: 'sequence' as const,
fields: headerBodyFields,
};
},
transform(resolved, attrs, config) {
let headerAstNodes: Node[];
let bodyAstNodes: Node[];
if (resolved.children) {
const inner = resolveSequence(resolved.children as Node[], headerBodyFields);
headerAstNodes = asNodes(inner.header);
bodyAstNodes = asNodes(inner.body);
} else {
headerAstNodes = asNodes(resolved.header);
bodyAstNodes = asNodes(resolved.body);
}
const header = new RenderableNodeCursor(
unwrapParagraphImages(Markdoc.transform(headerAstNodes, config) as RenderableTreeNode[]),
);
const bodyStream = new RenderableNodeCursor(
Markdoc.transform(bodyAstNodes, config) as RenderableTreeNode[],
);
const kindMeta = new Tag('meta', { content: attrs.kind });
const langMeta = new Tag('meta', { content: attrs.lang });
const sinceMeta = new Tag('meta', { content: attrs.since });
const deprecatedMeta = new Tag('meta', { content: attrs.deprecated });
const sourceMeta = new Tag('meta', { content: attrs.source });
const bodyDiv = bodyStream.wrap('div');
const children: any[] = [...header.toArray()];
children.push(bodyDiv.next());
return createComponentRenderable({
rune: 'symbol',
tag: 'article',
properties: {
kind: kindMeta,
lang: langMeta,
since: sinceMeta,
deprecated: deprecatedMeta,
source: sourceMeta,
},
refs: {
...pageSectionProperties(header),
body: bodyDiv,
},
children,
});
},
});
Reference documentation for one code construct: a function, class, interface, enum, type alias, module, hook or component. kind names which, and decides how the headings inside are read.
Function documentation
A function with signature, parameters, return value, and exception documentation.
{% symbol kind="function" lang="typescript" since="1.0.0" %}
## renderContent
Transforms a Markdoc document into a renderable tree using the specified rune definitions.
```typescript
renderContent(source: string, options?: RenderOptions): RenderTree
```
- **source** `string` -- Raw Markdoc content to parse and transform
- **options** `RenderOptions` *(optional)* -- Configuration for the render pass
- **runes** `RuneMap` -- Custom rune definitions to merge with defaults
- **variables** `Record<string, any>` -- Template variables available in content
> Returns `RenderTree` -- A framework-agnostic tree for rendering.
> Throws `ParseError` if the source contains invalid Markdoc syntax.
{% /symbol %}<article data-rune="symbol" data-rune-fields="{"kind":"function","lang":"typescript","since":"1.0.0","deprecated":"","source":""}" typeof="TechArticle">
<h2 id="rendercontent" data-name="headline" property="name">renderContent</h2>
<p data-name="blurb" property="description">Transforms a Markdoc document into a renderable tree using the specified rune definitions.</p>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">renderContent(source: string, options?: RenderOptions): RenderTree
</code>
</pre>
</div>
<ul>
<li>
<strong marker="**">source</strong>
<code>string</code>
-- Raw Markdoc content to parse and transform
</li>
<li>
<strong marker="**">options</strong>
<code>RenderOptions</code>
<em marker="*">(optional)</em>
-- Configuration for the render pass
<ul>
<li>
<strong marker="**">runes</strong>
<code>RuneMap</code>
-- Custom rune definitions to merge with defaults
</li>
<li>
<strong marker="**">variables</strong>
<code>Record<string, any></code>
-- Template variables available in content
</li>
</ul>
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>RenderTree</code>
-- A framework-agnostic tree for rendering.
</p>
</blockquote>
<blockquote data-quote="quotation">
<p>
Throws
<code>ParseError</code>
if the source contains invalid Markdoc syntax.
</p>
</blockquote>
</div>
</article>renderContent
Transforms a Markdoc document into a renderable tree using the specified rune definitions.
renderContent(source: string, options?: RenderOptions): RenderTree
- source
string-- Raw Markdoc content to parse and transform - options
RenderOptions(optional) -- Configuration for the render pass- runes
RuneMap-- Custom rune definitions to merge with defaults - variables
Record<string, any>-- Template variables available in content
- runes
Returns
RenderTree-- A framework-agnostic tree for rendering.
Throws
ParseErrorif the source contains invalid Markdoc syntax.
<article class="rf-symbol rf-symbol--function rf-symbol--typescript rf-symbol--1.0.0" typeof="TechArticle" data-kind="function" data-lang="typescript" data-since="1.0.0" data-deprecated="" data-source="" data-elevation="flat" data-rune="symbol" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-symbol__eyebrow">
<span data-meta-type="category" data-field="kind">function</span>
<span data-meta-type="category" data-field="lang">typescript</span>
</div>
<header data-name="preamble" class="rf-symbol__preamble" data-section="preamble">
<h2 id="rendercontent" data-name="headline" property="name" class="rf-symbol__headline" data-section="title">renderContent</h2>
<p data-name="blurb" property="description" class="rf-symbol__blurb">Transforms a Markdoc document into a renderable tree using the specified rune definitions.</p>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-symbol__metadata">
<div data-name="row" data-field="since" class="rf-symbol__row">
<dt data-meta-label="">Since</dt>
<dd>
<span data-meta-type="temporal">1.0.0</span>
</dd>
</div>
</dl>
<div data-name="body" class="rf-symbol__body" data-section="body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">renderContent(source: string, options?: RenderOptions): RenderTree
</code></pre>
</div>
<ul>
<li>
<strong marker="**">source</strong>
<code>string</code>
-- Raw Markdoc content to parse and transform
</li>
<li>
<strong marker="**">options</strong>
<code>RenderOptions</code>
<em marker="*">(optional)</em>
-- Configuration for the render pass
<ul>
<li>
<strong marker="**">runes</strong>
<code>RuneMap</code>
-- Custom rune definitions to merge with defaults
</li>
<li>
<strong marker="**">variables</strong>
<code>Record<string, any></code>
-- Template variables available in content
</li>
</ul>
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>RenderTree</code>
-- A framework-agnostic tree for rendering.
</p>
</blockquote>
<blockquote data-quote="quotation">
<p>
Throws
<code>ParseError</code>
if the source contains invalid Markdoc syntax.
</p>
</blockquote>
</div>
</article>How Markdown is read
| You write | It becomes |
|---|---|
A ## heading | The construct's name |
| The paragraphs right after it | Its description |
| A fence, a list and blockquotes after that | The body: signature, parameters, and notes such as returns and throws |
With kind class, interface or module: a ### heading | A member group, such as Constructor or Methods |
A #### heading inside a group | A member; the content under it is its body |
Class documentation
Classes, interfaces, and modules use ### headings for member groups (Constructor, Properties, Methods) and #### headings for individual members.
{% symbol kind="class" lang="typescript" since="1.0.0" %}
## ContentParser
The core parsing engine that transforms raw Markdoc source into an abstract syntax tree.
```typescript
class ContentParser extends EventEmitter
```
### Constructor
```typescript
new ContentParser(config: ParserConfig)
```
- **config** `ParserConfig` -- Parser configuration
- **strictMode** `boolean` -- Reject unknown runes. *Default: `false`*
- **maxDepth** `number` -- Maximum nesting depth. *Default: `10`*
### Methods
#### parse
Parse a Markdoc source string into a raw AST.
```typescript
parse(source: string): ASTNode
```
- **source** `string` -- Raw Markdoc content
> Returns `ASTNode` -- The root node of the parsed abstract syntax tree.
#### transform
Transform a parsed AST into a renderable tree.
```typescript
transform(ast: ASTNode, variables?: Record<string, any>): RenderTree
```
- **ast** `ASTNode` -- A parsed AST from the `parse` method
- **variables** `Record<string, any>` *(optional)* -- Template variables
> Returns `RenderTree` -- A framework-agnostic renderable tree.
> Throws `TransformError` if a rune's reinterpretation rules fail.
{% /symbol %}<article data-rune="symbol" data-rune-fields="{"kind":"class","lang":"typescript","since":"1.0.0","deprecated":"","source":""}" typeof="TechArticle">
<h2 id="contentparser" data-name="headline" property="name">ContentParser</h2>
<p data-name="blurb" property="description">The core parsing engine that transforms raw Markdoc source into an abstract syntax tree.</p>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">class ContentParser extends EventEmitter
</code>
</pre>
</div>
<section data-rune="symbol-group">
<h3 data-name="label">Constructor</h3>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">new ContentParser(config: ParserConfig)
</code>
</pre>
</div>
<section data-rune="symbol-member">
<h4 data-name="name"></h4>
<div data-name="body">
<strong marker="**">config</strong>
<code>ParserConfig</code>
-- Parser configuration
<ul>
<li>
<strong marker="**">strictMode</strong>
<code>boolean</code>
-- Reject unknown runes.
<em marker="*">
Default:
<code>false</code>
</em>
</li>
<li>
<strong marker="**">maxDepth</strong>
<code>number</code>
-- Maximum nesting depth.
<em marker="*">
Default:
<code>10</code>
</em>
</li>
</ul>
</div>
</section>
</div>
</section>
<section data-rune="symbol-group">
<h3 data-name="label">Methods</h3>
<div data-name="body">
<section data-rune="symbol-member">
<h4 data-name="name">parse</h4>
<div data-name="body">
<p>Parse a Markdoc source string into a raw AST.</p>
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">parse(source: string): ASTNode
</code>
</pre>
</div>
<ul>
<li>
<strong marker="**">source</strong>
<code>string</code>
-- Raw Markdoc content
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>ASTNode</code>
-- The root node of the parsed abstract syntax tree.
</p>
</blockquote>
</div>
</section>
<section data-rune="symbol-member">
<h4 data-name="name">transform</h4>
<div data-name="body">
<p>Transform a parsed AST into a renderable tree.</p>
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">transform(ast: ASTNode, variables?: Record<string, any>): RenderTree
</code>
</pre>
</div>
<ul>
<li>
<strong marker="**">ast</strong>
<code>ASTNode</code>
-- A parsed AST from the
<code>parse</code>
method
</li>
<li>
<strong marker="**">variables</strong>
<code>Record<string, any></code>
<em marker="*">(optional)</em>
-- Template variables
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>RenderTree</code>
-- A framework-agnostic renderable tree.
</p>
</blockquote>
<blockquote data-quote="quotation">
<p>
Throws
<code>TransformError</code>
if a rune's reinterpretation rules fail.
</p>
</blockquote>
</div>
</section>
</div>
</section>
</div>
</article>ContentParser
The core parsing engine that transforms raw Markdoc source into an abstract syntax tree.
class ContentParser extends EventEmitter
Constructor
new ContentParser(config: ParserConfig)
ParserConfig -- Parser configuration- strictMode
boolean-- Reject unknown runes. Default:false - maxDepth
number-- Maximum nesting depth. Default:10
Methods
parse
Parse a Markdoc source string into a raw AST.
parse(source: string): ASTNode
- source
string-- Raw Markdoc content
Returns
ASTNode-- The root node of the parsed abstract syntax tree.
transform
Transform a parsed AST into a renderable tree.
transform(ast: ASTNode, variables?: Record<string, any>): RenderTree
- ast
ASTNode-- A parsed AST from theparsemethod - variables
Record<string, any>(optional) -- Template variables
Returns
RenderTree-- A framework-agnostic renderable tree.
Throws
TransformErrorif a rune's reinterpretation rules fail.
<article class="rf-symbol rf-symbol--class rf-symbol--typescript rf-symbol--1.0.0" typeof="TechArticle" data-kind="class" data-lang="typescript" data-since="1.0.0" data-deprecated="" data-source="" data-elevation="flat" data-rune="symbol" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-symbol__eyebrow">
<span data-meta-type="category" data-field="kind">class</span>
<span data-meta-type="category" data-field="lang">typescript</span>
</div>
<header data-name="preamble" class="rf-symbol__preamble" data-section="preamble">
<h2 id="contentparser" data-name="headline" property="name" class="rf-symbol__headline" data-section="title">ContentParser</h2>
<p data-name="blurb" property="description" class="rf-symbol__blurb">The core parsing engine that transforms raw Markdoc source into an abstract syntax tree.</p>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-symbol__metadata">
<div data-name="row" data-field="since" class="rf-symbol__row">
<dt data-meta-label="">Since</dt>
<dd>
<span data-meta-type="temporal">1.0.0</span>
</dd>
</div>
</dl>
<div data-name="body" class="rf-symbol__body" data-section="body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">class ContentParser extends EventEmitter
</code></pre>
</div>
<section class="rf-symbol-group" data-rune="symbol-group" data-density="full">
<h3 data-name="label" class="rf-symbol-group__label">Constructor</h3>
<div data-name="body" class="rf-symbol-group__body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">new ContentParser(config: ParserConfig)
</code></pre>
</div>
<section class="rf-symbol-member" data-rune="symbol-member" data-density="full">
<h4 data-name="name" class="rf-symbol-member__name"></h4>
<div data-name="body" class="rf-symbol-member__body">
<strong marker="**">config</strong>
<code>ParserConfig</code>
-- Parser configuration
<ul>
<li>
<strong marker="**">strictMode</strong>
<code>boolean</code>
-- Reject unknown runes.
<em marker="*">
Default:
<code>false</code>
</em>
</li>
<li>
<strong marker="**">maxDepth</strong>
<code>number</code>
-- Maximum nesting depth.
<em marker="*">
Default:
<code>10</code>
</em>
</li>
</ul>
</div>
</section>
</div>
</section>
<section class="rf-symbol-group" data-rune="symbol-group" data-density="full">
<h3 data-name="label" class="rf-symbol-group__label">Methods</h3>
<div data-name="body" class="rf-symbol-group__body">
<section class="rf-symbol-member" data-rune="symbol-member" data-density="full">
<h4 data-name="name" class="rf-symbol-member__name">parse</h4>
<div data-name="body" class="rf-symbol-member__body">
<p>Parse a Markdoc source string into a raw AST.</p>
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">parse(source: string): ASTNode
</code></pre>
</div>
<ul>
<li>
<strong marker="**">source</strong>
<code>string</code>
-- Raw Markdoc content
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>ASTNode</code>
-- The root node of the parsed abstract syntax tree.
</p>
</blockquote>
</div>
</section>
<section class="rf-symbol-member" data-rune="symbol-member" data-density="full">
<h4 data-name="name" class="rf-symbol-member__name">transform</h4>
<div data-name="body" class="rf-symbol-member__body">
<p>Transform a parsed AST into a renderable tree.</p>
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">transform(ast: ASTNode, variables?: Record<string, any>): RenderTree
</code></pre>
</div>
<ul>
<li>
<strong marker="**">ast</strong>
<code>ASTNode</code>
-- A parsed AST from the
<code>parse</code>
method
</li>
<li>
<strong marker="**">variables</strong>
<code>Record<string, any></code>
<em marker="*">(optional)</em>
-- Template variables
</li>
</ul>
<blockquote data-quote="quotation">
<p>
Returns
<code>RenderTree</code>
-- A framework-agnostic renderable tree.
</p>
</blockquote>
<blockquote data-quote="quotation">
<p>
Throws
<code>TransformError</code>
if a rune's reinterpretation rules fail.
</p>
</blockquote>
</div>
</section>
</div>
</section>
</div>
</article>Enum documentation
Enum members are defined as a list with name "value" -- description format.
{% symbol kind="enum" lang="typescript" since="1.2.0" %}
## RuneCategory
Classification categories for runes in the registry.
```typescript
enum RuneCategory
```
- **Layout** `"layout"` -- Core structural runes (section, grid, columns)
- **Content** `"content"` -- Content structure runes (tabs, accordion, callout)
- **Data** `"data"` -- Data display and reference runes (datatable, chart, codegroup)
- **Interactive** `"interactive"` -- User interaction runes (form, quiz, poll)
{% /symbol %}<article data-rune="symbol" data-rune-fields="{"kind":"enum","lang":"typescript","since":"1.2.0","deprecated":"","source":""}" typeof="TechArticle">
<h2 id="runecategory" data-name="headline" property="name">RuneCategory</h2>
<p data-name="blurb" property="description">Classification categories for runes in the registry.</p>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">enum RuneCategory
</code>
</pre>
</div>
<ul>
<li>
<strong marker="**">Layout</strong>
<code>"layout"</code>
-- Core structural runes (section, grid, columns)
</li>
<li>
<strong marker="**">Content</strong>
<code>"content"</code>
-- Content structure runes (tabs, accordion, callout)
</li>
<li>
<strong marker="**">Data</strong>
<code>"data"</code>
-- Data display and reference runes (datatable, chart, codegroup)
</li>
<li>
<strong marker="**">Interactive</strong>
<code>"interactive"</code>
-- User interaction runes (form, quiz, poll)
</li>
</ul>
</div>
</article>RuneCategory
Classification categories for runes in the registry.
enum RuneCategory
- Layout
"layout"-- Core structural runes (section, grid, columns) - Content
"content"-- Content structure runes (tabs, accordion, callout) - Data
"data"-- Data display and reference runes (datatable, chart, codegroup) - Interactive
"interactive"-- User interaction runes (form, quiz, poll)
<article class="rf-symbol rf-symbol--enum rf-symbol--typescript rf-symbol--1.2.0" typeof="TechArticle" data-kind="enum" data-lang="typescript" data-since="1.2.0" data-deprecated="" data-source="" data-elevation="flat" data-rune="symbol" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-symbol__eyebrow">
<span data-meta-type="category" data-field="kind">enum</span>
<span data-meta-type="category" data-field="lang">typescript</span>
</div>
<header data-name="preamble" class="rf-symbol__preamble" data-section="preamble">
<h2 id="runecategory" data-name="headline" property="name" class="rf-symbol__headline" data-section="title">RuneCategory</h2>
<p data-name="blurb" property="description" class="rf-symbol__blurb">Classification categories for runes in the registry.</p>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-symbol__metadata">
<div data-name="row" data-field="since" class="rf-symbol__row">
<dt data-meta-label="">Since</dt>
<dd>
<span data-meta-type="temporal">1.2.0</span>
</dd>
</div>
</dl>
<div data-name="body" class="rf-symbol__body" data-section="body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">enum RuneCategory
</code></pre>
</div>
<ul>
<li>
<strong marker="**">Layout</strong>
<code>"layout"</code>
-- Core structural runes (section, grid, columns)
</li>
<li>
<strong marker="**">Content</strong>
<code>"content"</code>
-- Content structure runes (tabs, accordion, callout)
</li>
<li>
<strong marker="**">Data</strong>
<code>"data"</code>
-- Data display and reference runes (datatable, chart, codegroup)
</li>
<li>
<strong marker="**">Interactive</strong>
<code>"interactive"</code>
-- User interaction runes (form, quiz, poll)
</li>
</ul>
</div>
</article>Type alias
Type aliases are the simplest form -- just a name, description, and type definition.
{% symbol kind="type" lang="typescript" %}
## RuneMap
A mapping of rune names to their definitions. Used to register custom runes or override built-in rune behavior.
```typescript
type RuneMap = Record<string, RuneDefinition>
```
{% /symbol %}<article data-rune="symbol" data-rune-fields="{"kind":"type","lang":"typescript","since":"","deprecated":"","source":""}" typeof="TechArticle">
<h2 id="runemap" data-name="headline" property="name">RuneMap</h2>
<p data-name="blurb" property="description">A mapping of rune names to their definitions. Used to register custom runes or override built-in rune behavior.</p>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">type RuneMap = Record<string, RuneDefinition>
</code>
</pre>
</div>
</div>
</article>RuneMap
A mapping of rune names to their definitions. Used to register custom runes or override built-in rune behavior.
type RuneMap = Record<string, RuneDefinition>
<article class="rf-symbol rf-symbol--type rf-symbol--typescript" typeof="TechArticle" data-kind="type" data-lang="typescript" data-since="" data-deprecated="" data-source="" data-elevation="flat" data-rune="symbol" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-symbol__eyebrow">
<span data-meta-type="category" data-field="kind">type</span>
<span data-meta-type="category" data-field="lang">typescript</span>
</div>
<header data-name="preamble" class="rf-symbol__preamble" data-section="preamble">
<h2 id="runemap" data-name="headline" property="name" class="rf-symbol__headline" data-section="title">RuneMap</h2>
<p data-name="blurb" property="description" class="rf-symbol__blurb">A mapping of rune names to their definitions. Used to register custom runes or override built-in rune behavior.</p>
</header>
<div data-name="body" class="rf-symbol__body" data-section="body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">type RuneMap = Record<string, RuneDefinition>
</code></pre>
</div>
</div>
</article>Deprecated construct
Set the deprecated attribute to mark a construct as deprecated. Add a source attribute to link to the source code.
{% symbol kind="function" deprecated="2.0.0" source="https://github.com/example/blob/main/src/legacy.ts#L42" %}
## legacyRender
This function is deprecated. Use `renderContent` instead.
```typescript
legacyRender(source: string): any
```
{% /symbol %}<article data-rune="symbol" data-rune-fields="{"kind":"function","lang":"typescript","since":"","deprecated":"2.0.0","source":"https://github.com/example/blob/main/src/legacy.ts#L42"}" typeof="TechArticle">
<h2 id="legacyrender" data-name="headline" property="name">legacyRender</h2>
<p data-name="blurb" property="description">
This function is deprecated. Use
<code>renderContent</code>
instead.
</p>
<div data-name="body">
<div class="rf-codeblock">
<pre data-language="typescript">
<code data-language="typescript">legacyRender(source: string): any
</code>
</pre>
</div>
</div>
</article>legacyRender
This function is deprecated. Use renderContent instead.
legacyRender(source: string): any
<article class="rf-symbol rf-symbol--function rf-symbol--typescript rf-symbol--2.0.0 rf-symbol--https://github.com/example/blob/main/src/legacy.ts#L42" typeof="TechArticle" data-kind="function" data-lang="typescript" data-since="" data-deprecated="2.0.0" data-source="https://github.com/example/blob/main/src/legacy.ts#L42" data-elevation="flat" data-rune="symbol" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-symbol__eyebrow">
<span data-meta-type="category" data-field="kind">function</span>
<span data-meta-type="category" data-field="lang">typescript</span>
<a href="https://github.com/example/blob/main/src/legacy.ts#L42" data-meta-type="link" data-align="end" data-field="source">Source</a>
</div>
<header data-name="preamble" class="rf-symbol__preamble" data-section="preamble">
<h2 id="legacyrender" data-name="headline" property="name" class="rf-symbol__headline" data-section="title">legacyRender</h2>
<p data-name="blurb" property="description" class="rf-symbol__blurb">
This function is deprecated. Use
<code>renderContent</code>
instead.
</p>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-symbol__metadata">
<div data-name="row" data-field="deprecated" class="rf-symbol__row">
<dt data-meta-label="">Deprecated</dt>
<dd>
<span data-meta-type="status">2.0.0</span>
</dd>
</div>
</dl>
<div data-name="body" class="rf-symbol__body" data-section="body">
<div class="rf-codeblock">
<pre data-language="typescript"><code data-language="typescript">legacyRender(source: string): any
</code></pre>
</div>
</div>
</article>Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
kind | "function" | "class" | "interface" | "enum" | "type" | "module" | "hook" | "component" | — | Symbol category that controls grouping behavior and icon display. |
lang | string | — | Programming language used for syntax highlighting in code examples. |
since | string | — | Version when this symbol was introduced (e.g. "1.2.0"). |
deprecated | string | — | Deprecation notice with version or reason; leave empty if not deprecated. |
source | string | — | URL to the source file or repository for this symbol. |
Universal attributes
bg
The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | Gradient start colour — a semantic token name (→ var(--rf-color-*)) |
bg-gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (bounded named set) |
bg-gradient-type | "linear" | "radial" | "conic" | — | Gradient type |
bg-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | Optional middle gradient stop — a semantic token name |
scrim | "top" | "bottom" | "left" | "right" | "none" | — | Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim |
scrim-blur | "none" | "sm" | "md" | "lg" | — | Frost scrim blur amount |
scrim-strength | "sm" | "md" | "lg" | — | Gradient scrim strength |
scrim-tone | "dark" | "light" | — | Whether the scrim darkens (for light text) or lightens (for dark text) |
scrim-type | "gradient" | "frost" | — | Scrim treatment: gradient (default) or frost (backdrop blur) |
elevation
How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.
| Attribute | Type | Required | Description |
|---|---|---|---|
elevation | "sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg" | — | Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating) |
inset
Internal padding override.
| Attribute | Type | Required | Description |
|---|---|---|---|
inset | "flush" | "tight" | "default" | "loose" | "breathe" | — | Inner padding of this block |
motion
Scroll-reveal entrance. You choose its character; the theme decides how it moves.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
prominence
Header emphasis. Scales a rune's header, or its featured quotation; the theme decides the type size for each step.
| Attribute | Type | Required | Description |
|---|---|---|---|
prominence | "quiet" | "normal" | "prominent" | "display" | "marquee" | — | Emphasis of a page-section header or a featured quotation (only on runes that have one) |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
substrate | "dots" | "grid" | "lines" | "cross" | "checker" | "none" | — | Generated surface pattern |
substrate-fill | "inherit" | "inset" | — | Surface fill the pattern sits on (full colour stays with tint) |
substrate-opacity | "sm" | "md" | "lg" | — | Pattern ink strength |
substrate-size | "sm" | "md" | "lg" | — | Pattern cell size |
substrate-target | "self" | "media" | — | Which surface the pattern fills (overrides the rune/theme default) |
tint
Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | Color tint preset applied to this block |
tint-mode | "auto" | "dark" | "light" | — | Whether the tint adapts to auto, dark, or light mode |
width
The track a block rune occupies.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| dropcap, reading | this rune declares no prose body |
| frame | this rune declares neither a `frameTarget` nor a media section |
symbol-group
Universal attributes
bg
The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | Gradient start colour — a semantic token name (→ var(--rf-color-*)) |
bg-gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (bounded named set) |
bg-gradient-type | "linear" | "radial" | "conic" | — | Gradient type |
bg-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | Optional middle gradient stop — a semantic token name |
scrim | "top" | "bottom" | "left" | "right" | "none" | — | Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim |
scrim-blur | "none" | "sm" | "md" | "lg" | — | Frost scrim blur amount |
scrim-strength | "sm" | "md" | "lg" | — | Gradient scrim strength |
scrim-tone | "dark" | "light" | — | Whether the scrim darkens (for light text) or lightens (for dark text) |
scrim-type | "gradient" | "frost" | — | Scrim treatment: gradient (default) or frost (backdrop blur) |
elevation
How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.
| Attribute | Type | Required | Description |
|---|---|---|---|
elevation | "sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg" | — | Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating) |
inset
Internal padding override.
| Attribute | Type | Required | Description |
|---|---|---|---|
inset | "flush" | "tight" | "default" | "loose" | "breathe" | — | Inner padding of this block |
motion
Scroll-reveal entrance. You choose its character; the theme decides how it moves.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
substrate | "dots" | "grid" | "lines" | "cross" | "checker" | "none" | — | Generated surface pattern |
substrate-fill | "inherit" | "inset" | — | Surface fill the pattern sits on (full colour stays with tint) |
substrate-opacity | "sm" | "md" | "lg" | — | Pattern ink strength |
substrate-size | "sm" | "md" | "lg" | — | Pattern cell size |
substrate-target | "self" | "media" | — | Which surface the pattern fills (overrides the rune/theme default) |
tint
Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | Color tint preset applied to this block |
tint-mode | "auto" | "dark" | "light" | — | Whether the tint adapts to auto, dark, or light mode |
width
The track a block rune occupies.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| dropcap, reading | this rune declares no prose body |
| frame | this rune declares neither a `frameTarget` nor a media section |
| prominence | this rune has no page-section header or featured quotation |
symbol-member
Universal attributes
bg
The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | Gradient start colour — a semantic token name (→ var(--rf-color-*)) |
bg-gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (bounded named set) |
bg-gradient-type | "linear" | "radial" | "conic" | — | Gradient type |
bg-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | Optional middle gradient stop — a semantic token name |
scrim | "top" | "bottom" | "left" | "right" | "none" | — | Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim |
scrim-blur | "none" | "sm" | "md" | "lg" | — | Frost scrim blur amount |
scrim-strength | "sm" | "md" | "lg" | — | Gradient scrim strength |
scrim-tone | "dark" | "light" | — | Whether the scrim darkens (for light text) or lightens (for dark text) |
scrim-type | "gradient" | "frost" | — | Scrim treatment: gradient (default) or frost (backdrop blur) |
elevation
How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.
| Attribute | Type | Required | Description |
|---|---|---|---|
elevation | "sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg" | — | Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating) |
inset
Internal padding override.
| Attribute | Type | Required | Description |
|---|---|---|---|
inset | "flush" | "tight" | "default" | "loose" | "breathe" | — | Inner padding of this block |
motion
Scroll-reveal entrance. You choose its character; the theme decides how it moves.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
substrate | "dots" | "grid" | "lines" | "cross" | "checker" | "none" | — | Generated surface pattern |
substrate-fill | "inherit" | "inset" | — | Surface fill the pattern sits on (full colour stays with tint) |
substrate-opacity | "sm" | "md" | "lg" | — | Pattern ink strength |
substrate-size | "sm" | "md" | "lg" | — | Pattern cell size |
substrate-target | "self" | "media" | — | Which surface the pattern fills (overrides the rune/theme default) |
tint
Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | Color tint preset applied to this block |
tint-mode | "auto" | "dark" | "light" | — | Whether the tint adapts to auto, dark, or light mode |
width
The track a block rune occupies.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| dropcap, reading | this rune declares no prose body |
| frame | this rune declares neither a `frameTarget` nor a media section |
| prominence | this rune has no page-section header or featured quotation |