marketing
Steps
Step-by-step instructions with numbered indicators
Install
- Add the package:
npm install @refrakt-md/marketing - Add it to the
pluginsarray inrefrakt.config.json:"plugins": ["@refrakt-md/marketing"]
Source
import Markdoc from '@markdoc/markdoc';
import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
import type { ResolvedContent } from '@refrakt-md/types';
const { Ast, Tag } = Markdoc;
import {
createComponentRenderable,
createContentModelSchema,
SplitLayoutModel,
buildLayoutMetas,
nameHelper as name,
pageSectionProperties,
asNodes,
renderNodes,
unwrapParagraphImages,
} from '@refrakt-md/runes';
import { RenderableNodeCursor } from '@refrakt-md/runes';
export const stepMediaSlots = { media: 'cover' } as const;
export const step = createContentModelSchema({
mediaSlots: stepMediaSlots,
base: SplitLayoutModel,
contentModel: {
type: 'delimited',
delimiter: 'hr',
zones: [
{
name: 'media',
type: 'sequence',
fields: [{ name: 'content', match: 'any', optional: true, greedy: true }],
},
{
name: 'content',
primary: true,
type: 'sequence',
fields: [{ name: 'content', match: 'any', optional: true, greedy: true }],
},
],
},
transform(resolved, attrs, config) {
const contentZone = (resolved.content ?? {}) as ResolvedContent;
const mediaZone = (resolved.media ?? {}) as ResolvedContent;
const main = renderNodes(contentZone.content, config);
const side = new RenderableNodeCursor(
unwrapParagraphImages(
Markdoc.transform(asNodes(mediaZone.content), config) as RenderableTreeNode[],
),
);
const mainContent = main.wrap('div');
const sideContent = side.wrap('div');
const { metas: layoutMetas } = buildLayoutMetas({
...attrs,
'media-position': attrs['media-position'] ?? 'bottom',
});
const {
mediaPosition: mediaPositionMeta,
mediaRatio: mediaRatioMeta,
valign: valignMeta,
collapse: collapseMeta,
} = layoutMetas;
const children = [
mainContent.next(),
...(side.toArray().length > 0 ? [sideContent.next()] : []),
];
return createComponentRenderable({
rune: 'step',
tag: 'li',
properties: {
name: name(main),
'media-position': mediaPositionMeta,
'media-ratio': mediaRatioMeta,
valign: valignMeta,
collapse: collapseMeta,
},
refs: {
content: mainContent.tag('div'),
media: sideContent.tag('div'),
},
children,
});
},
});
export const stepsSections = {
preamble: 'preamble',
eyebrow: 'eyebrow',
headline: 'title',
blurb: 'description',
} as const;
export const steps = createContentModelSchema({
sections: stepsSections,
attributes: {},
contentModel: () => ({
when: [
{
condition: { hasChild: 'heading' },
model: {
type: 'sections' as const,
sectionHeading: 'heading',
fields: [{ name: 'header', match: 'heading|paragraph', optional: true, greedy: true }],
sectionModel: {
type: 'sequence' as const,
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
},
},
},
],
default: {
type: 'sequence' as const,
fields: [
{ name: 'header', match: 'paragraph', optional: true, greedy: true },
{ name: 'list', match: 'list:ordered', optional: true },
],
},
}),
transform(resolved, attrs, config) {
const headerNodes = renderNodes(resolved.header, config);
let stepItems: RenderableNodeCursor<any>;
if (resolved.sections) {
const sections = resolved.sections as Array<{
$headingNode: Node;
body: unknown;
}>;
const stepTagNodes = sections.map(
(section) =>
new Ast.Node('tag', {}, [section.$headingNode, ...asNodes(section.body)], 'step'),
);
const stepStream = new RenderableNodeCursor(
Markdoc.transform(stepTagNodes, config) as RenderableTreeNode[],
);
stepItems = stepStream.tag('li').typeof('Step');
} else {
const listNode = asNodes(resolved.list)[0] as Node | undefined;
const itemNodes = listNode?.children ?? [];
const stepTagNodes = itemNodes.map((item) => new Ast.Node('tag', {}, item.children, 'step'));
const stepStream = new RenderableNodeCursor(
Markdoc.transform(stepTagNodes, config) as RenderableTreeNode[],
);
stepItems = stepStream.tag('li').typeof('Step');
}
const stepList = new Tag('ol', {}, stepItems.toArray());
const children = headerNodes.count() > 0 ? [...headerNodes.toArray(), stepList] : [stepList];
return createComponentRenderable({
rune: 'steps',
tag: 'section',
properties: {
step: stepItems,
},
refs: {
...pageSectionProperties(headerNodes),
steps: stepList,
},
children,
});
},
});
Numbered instructions a reader follows in order: installing, onboarding, a process. For dated events, use timeline; for a product's releases, changelog.
Basic usage
{% steps %}
1. Install the dependencies
Run the install command for your package manager.
2. Create your content directory
Add a `content/` folder with your Markdown files.
3. Start the dev server
Run `npm run dev` and visit localhost.
{% /steps %}<section data-rune="steps">
<ol data-name="steps">
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<p>Install the dependencies</p>
<p>Run the install command for your package manager.</p>
</div>
</li>
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<p>Create your content directory</p>
<p>
Add a
<code>content/</code>
folder with your Markdown files.
</p>
</div>
</li>
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<p>Start the dev server</p>
<p>
Run
<code>npm run dev</code>
and visit localhost.
</p>
</div>
</li>
</ol>
</section>- 1
Install the dependencies
Run the install command for your package manager.
- 2
Create your content directory
Add a
content/folder with your Markdown files. - 3
Start the dev server
Run
npm run devand visit localhost.
<section class="rf-steps" data-elevation="flush" data-rune="steps" data-density="full">
<ol data-name="steps" data-sequence="numbered" class="rf-steps__steps">
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">1</span>
<div data-name="content" class="rf-step__content">
<p>Install the dependencies</p>
<p>Run the install command for your package manager.</p>
</div>
</li>
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">2</span>
<div data-name="content" class="rf-step__content">
<p>Create your content directory</p>
<p>
Add a
<code>content/</code>
folder with your Markdown files.
</p>
</div>
</li>
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">3</span>
<div data-name="content" class="rf-step__content">
<p>Start the dev server</p>
<p>
Run
<code>npm run dev</code>
and visit localhost.
</p>
</div>
</li>
</ol>
</section>How Markdown is read
| You write | It becomes |
|---|---|
| A numbered list | The steps, one per item |
| Or a heading per step | A step: the heading and the content under it, up to the next |
--- inside a heading-based step | Splits the step's media (before) from its text (after) |
| A heading one level above the step headings, with a short paragraph before and a paragraph after, ahead of the first step | The eyebrow, headline and blurb (Page sections) |
| A paragraph before a numbered list | The blurb |
Heading-based steps
Headings are automatically converted into steps instead of list items.
{% steps %}
### Clone the repository
Fork and clone the repo to your local machine.
### Install dependencies
Run `npm install` to set up all packages.
### Run the tests
Verify everything works with `npm test`.
{% /steps %}<section data-rune="steps">
<ol data-name="steps">
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<h3 id="clone-the-repository" data-field="name">Clone the repository</h3>
<p>Fork and clone the repo to your local machine.</p>
</div>
</li>
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<h3 id="install-dependencies" data-field="name">Install dependencies</h3>
<p>
Run
<code>npm install</code>
to set up all packages.
</p>
</div>
</li>
<li data-rune="step" data-rune-fields="{"media-position":"bottom"}" data-field="step">
<div data-name="content">
<h3 id="run-the-tests" data-field="name">Run the tests</h3>
<p>
Verify everything works with
<code>npm test</code>
.
</p>
</div>
</li>
</ol>
</section>- 1
Clone the repository
Fork and clone the repo to your local machine.
- 2
Install dependencies
Run
npm installto set up all packages. - 3
Run the tests
Verify everything works with
npm test.
<section class="rf-steps" data-elevation="flush" data-rune="steps" data-density="full">
<ol data-name="steps" data-sequence="numbered" class="rf-steps__steps">
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">1</span>
<div data-name="content" class="rf-step__content">
<h3 id="clone-the-repository" data-field="name">Clone the repository</h3>
<p>Fork and clone the repo to your local machine.</p>
</div>
</li>
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">2</span>
<div data-name="content" class="rf-step__content">
<h3 id="install-dependencies" data-field="name">Install dependencies</h3>
<p>
Run
<code>npm install</code>
to set up all packages.
</p>
</div>
</li>
<li class="rf-step" data-field="step" data-media-position="bottom" data-rune="step" data-density="full">
<span data-name="ordinal" data-meta-type="quantity" class="rf-step__ordinal">3</span>
<div data-name="content" class="rf-step__content">
<h3 id="run-the-tests" data-field="name">Run the tests</h3>
<p>
Verify everything works with
<code>npm test</code>
.
</p>
</div>
</li>
</ol>
</section>Place a step's media
Individual steps (heading-delimited blocks) accept the shared media+content layout vocabulary — the body splits on --- into media → content zones (media-first in source); media-position controls visual placement.
media-ratio, valign and collapse tune a side-by-side split, as on card.
Attributes
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 |
step
Inherited from the split layout preset
| Attribute | Type | Required | Description |
|---|---|---|---|
media-position | "top" | "bottom" | "start" | "end" | "cover" | — | Where the media zone sits relative to the content: above (top), below (bottom), or beside (start/end) |
media-ratio | "1/3" | "2/5" | "1/2" | "3/5" | "2/3" | — | Media zone’s share of the row width when media is beside content (start/end) |
valign | "top" | "center" | "bottom" | "stretch" | — | Cross-axis alignment when media is beside content (start/end); applies to the shorter zone |
collapse | "sm" | "md" | "lg" | "never" | — | Breakpoint at which side-by-side layouts collapse to a single stacked column |
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 |