Marketing›Feature

marketing

Feature

Feature showcases with name, description, and optional icons

Install

  1. Add the package: npm install @refrakt-md/marketing
  2. Add it to the plugins array in refrakt.config.json: "plugins": ["@refrakt-md/marketing"]

About the plugin and its runes

Source

import Markdoc from '@markdoc/markdoc';
import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
import type { ResolvedContent } from '@refrakt-md/types';
const { Tag, Ast } = Markdoc;
import {
	createContentModelSchema,
	createComponentRenderable,
	asNodes,
	renderNodes,
	RenderableNodeCursor,
	SplitLayoutModel,
	buildLayoutMetas,
	pageSectionProperties,
	unwrapParagraphImages,
	LAYOUT,
	layoutMatches,
} from '@refrakt-md/runes';

function isTermParagraph(node: Node): boolean {
	for (const child of node.walk()) {
		if (child.type === 'image') return true;
		if (child.type === 'tag' && child.tag === 'icon') return true;
		if (child.type === 'strong') return true;
	}
	return false;
}

function splitDefinitionChildren(nodes: unknown[]): unknown[] {
	return nodes as Node[];
}

export const definition = createContentModelSchema({
	contentModel: {
		type: 'custom',
		processChildren: splitDefinitionChildren,
		description:
			'Splits children into term (headings + paragraphs with image/icon/strong) and description (remaining paragraphs).',
	},
	transform(resolved, attrs, config) {
		const labelIcon = (node: any) => {
			if (Tag.isTag(node)) node.attributes['data-name'] = 'icon';
			return node;
		};

		const allChildren = asNodes(resolved.children);
		const termNodes: Node[] = [];
		const descNodes: Node[] = [];
		let inDescription = false;

		for (const node of allChildren) {
			if (
				!inDescription &&
				(node.type === 'heading' || (node.type === 'paragraph' && isTermParagraph(node)))
			) {
				termNodes.push(node);
			} else if (node.type === 'paragraph') {
				inDescription = true;
				descNodes.push(node);
			} else if (!inDescription) {
				inDescription = true;
			}
		}

		const dtChildren: any[] = [];
		for (const node of termNodes) {
			if (node.type === 'paragraph') {
				const img = Array.from(node.walk()).find((n) => n.type === 'image');
				if (img) {
					dtChildren.push(labelIcon(Markdoc.transform(img, config)));
					continue;
				}
				const iconTag = Array.from(node.walk()).find((n) => n.type === 'tag' && n.tag === 'icon');
				if (iconTag) {
					const strong = Array.from(node.walk()).find((n) => n.type === 'strong');
					const iconResult = labelIcon(Markdoc.transform(iconTag, config));
					if (strong) {
						dtChildren.push(
							iconResult,
							new Tag('span', { 'data-name': 'title' }, strong.transformChildren(config)),
						);
						continue;
					}
					dtChildren.push(iconResult);
					continue;
				}
				const strong = Array.from(node.walk()).find((n) => n.type === 'strong');
				if (strong) {
					dtChildren.push(
						new Tag('span', { 'data-name': 'title' }, strong.transformChildren(config)),
					);
					continue;
				}
				dtChildren.push(Markdoc.transform(node, config));
				continue;
			}
			if (node.type === 'heading') {
				const img = Array.from(node.walk()).find((n) => n.type === 'image');
				const text = Array.from(node.walk()).filter((n) => n.type === 'text');
				const span = new Tag('span', { 'data-name': 'title' }, Markdoc.transform(text, config));
				if (img) {
					dtChildren.push(labelIcon(Markdoc.transform(img, config)), span);
					continue;
				}
				dtChildren.push(span);
				continue;
			}
		}
		const dt = new RenderableNodeCursor(dtChildren).wrap('dt');

		const ddChildren: any[] = [];
		for (const node of descNodes) {
			ddChildren.push(
				new Tag('dd', { 'data-name': 'description' }, node.transformChildren(config)),
			);
		}
		const dd = new RenderableNodeCursor(ddChildren);

		return new Tag('div', {}, dt.concat(dd).toArray());
	},
});

const alignType = ['left', 'center', 'right'] as const;

export const featureSections = {
	preamble: 'preamble',
	eyebrow: 'eyebrow',
	headline: 'title',
	blurb: 'description',
	media: 'media',
} as const;
export const featureMediaSlots = { media: 'cover' } as const;

export const feature = createContentModelSchema({
	sections: featureSections,
	mediaSlots: featureMediaSlots,
	base: SplitLayoutModel,
	attributes: {
		align: {
			type: String,
			required: false,
			matches: alignType.slice(),
			description: 'Horizontal alignment of headline and body text',
		},
		layout: {
			type: String,
			required: false,
			matches: layoutMatches([LAYOUT.grid, LAYOUT.list, LAYOUT.carousel]),
			description:
				'Arrangement of feature-items: grid (tiled), list (single column), or carousel (scroll-snap track). Defaults from media-position when unset.',
		},
		'collapse-to': {
			type: String,
			required: false,
			matches: ['stack', 'carousel'],
			description:
				'Collapsed (mobile) form below the `collapse` breakpoint: stack (default) or carousel (a scroll-snap row).',
		},
	},
	contentModel: {
		type: 'delimited',
		delimiter: 'hr',
		zones: [
			{
				name: 'media',
				type: 'sequence',
				fields: [{ name: 'media', match: 'any', optional: true, greedy: true }],
			},
			{
				name: 'content',
				primary: true,
				type: 'sequence',
				fields: [
					{ name: 'eyebrow', match: 'paragraph', optional: true },
					{ name: 'headline', match: 'heading', optional: true },
					{ name: 'blurb', match: 'paragraph', optional: true },
					{
						name: 'definitions',
						match: 'list',
						optional: true,
						greedy: true,
						template: '- **Title**\n\n  Description',
					},
				],
			},
		],
	},
	transform(resolved, attrs, config) {
		const contentZone = (resolved.content ?? {}) as ResolvedContent;
		const mediaZone = (resolved.media ?? {}) as ResolvedContent;

		const headerAstNodes = [contentZone.eyebrow, contentZone.headline, contentZone.blurb].filter(
			Boolean,
		) as Node[];
		const header = new RenderableNodeCursor(
			Markdoc.transform(headerAstNodes, config) as RenderableTreeNode[],
		);

		const defConfig = {
			...config,
			nodes: {
				...config.nodes,
				item: {
					transform(node: Node, innerConfig: Record<string, any>) {
						return Markdoc.transform(
							new Ast.Node('tag', {}, node.children, 'definition'),
							innerConfig,
						);
					},
				},
				list: {
					transform(node: Node, innerConfig: Record<string, any>) {
						return new Tag(
							'dl',
							{ 'data-columns': node.children.length },
							node.transformChildren(innerConfig),
						);
					},
				},
			},
		};
		const definitions = renderNodes(contentZone.definitions, defConfig);

		const side = new RenderableNodeCursor(
			unwrapParagraphImages(
				Markdoc.transform(asNodes(mediaZone.media), config) as RenderableTreeNode[],
			),
		);

		const align = (attrs.align as string) || 'center';
		const alignMeta = new Tag('meta', { content: align });
		const resolvedMediaPosition = (attrs['media-position'] as string) ?? 'bottom';
		const { metas: layoutMetas } = buildLayoutMetas({
			...attrs,
			'media-position': resolvedMediaPosition,
		});
		const {
			mediaPosition: mediaPositionMeta,
			mediaRatio: mediaRatioMeta,
			valign: valignMeta,
			collapse: collapseMeta,
		} = layoutMetas;

		const stackedMedia = resolvedMediaPosition === 'top' || resolvedMediaPosition === 'bottom';
		const effectiveLayout = (attrs.layout as string) ?? (stackedMedia ? LAYOUT.grid : LAYOUT.list);
		const layoutMeta = new Tag('meta', { content: effectiveLayout });

		const collapseTo = (attrs['collapse-to'] as string) ?? 'stack';
		const collapseToMeta =
			collapseTo !== 'stack' ? new Tag('meta', { content: collapseTo }) : undefined;

		const headerContent = header.count() > 0 ? [header.wrap('header').next()] : [];
		const mainContent = new RenderableNodeCursor([...headerContent, ...definitions.toArray()]).wrap(
			'div',
		);
		const mediaContent = side.wrap('div');

		const children = [
			mainContent.next(),
			...(side.toArray().length > 0 ? [mediaContent.next()] : []),
		];

		return createComponentRenderable({
			rune: 'feature',
			tag: 'section',
			properties: {
				'media-position': mediaPositionMeta,
				layout: layoutMeta,
				'collapse-to': collapseToMeta,
				align: alignMeta,
				'media-ratio': mediaRatioMeta,
				valign: valignMeta,
				collapse: collapseMeta,
			},
			refs: {
				...pageSectionProperties(header),
				'feature-item': definitions.flatten().tag('div'),
				content: mainContent,
				media: mediaContent,
			},
			children,
		});
	},
	deprecations: {
		justify: { newName: 'align' },
	},
});

View plugins/marketing/src/tags/feature.ts on GitHub

A set of features or benefits, each with a name and a short description, optionally beside an image or code sample.

Basic usage

An eyebrow, a headline and a short blurb introduce a grid of named features.

{% feature %}
what you get

## Structured data

Refrakt gives you the building blocks to ship structured content sites without fighting your framework.

- **Semantic runes**

  Markdown primitives take on different meaning depending on the wrapping rune. Write Markdown — the rune decides what it means.

- **Type-safe output**

  Every rune produces typed, validated content that your theme components can rely on.

- **Layout inheritance**

  Define regions once in a parent layout. Child pages inherit and can override with prepend, append, or replace modes.
{% /feature %}
<section data-rune="feature" data-rune-fields="{&quot;media-position&quot;:&quot;bottom&quot;,&quot;layout&quot;:&quot;grid&quot;,&quot;align&quot;:&quot;center&quot;}">
  <div data-name="content">
    <header>
      <p data-name="eyebrow">what you get</p>
      <h2 id="structured-data" data-name="headline">Structured data</h2>
      <p data-name="blurb">Refrakt gives you the building blocks to ship structured content sites without fighting your framework.</p>
    </header>
    <dl data-columns="3">
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Semantic runes</span>
        </dt>
        <dd data-name="description">Markdown primitives take on different meaning depending on the wrapping rune. Write Markdown — the rune decides what it means.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description">Every rune produces typed, validated content that your theme components can rely on.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Layout inheritance</span>
        </dt>
        <dd data-name="description">Define regions once in a parent layout. Child pages inherit and can override with prepend, append, or replace modes.</dd>
      </div>
    </dl>
  </div>
</section>

what you get

Structured data

Refrakt gives you the building blocks to ship structured content sites without fighting your framework.

Semantic runes
Markdown primitives take on different meaning depending on the wrapping rune. Write Markdown — the rune decides what it means.
Type-safe output
Every rune produces typed, validated content that your theme components can rely on.
Layout inheritance
Define regions once in a parent layout. Child pages inherit and can override with prepend, append, or replace modes.
<section class="rf-feature rf-feature--center rf-feature--full" data-media-position="bottom" data-layout="grid" data-align="center" data-width="full" data-content-measure="anchored" data-elevation="flush" data-rune="feature" data-density="full">
  <div data-name="content" class="rf-feature__content">
    <header data-name="preamble" class="rf-feature__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-feature__eyebrow" data-section="eyebrow">what you get</p>
      <h2 id="structured-data" data-name="headline" class="rf-feature__headline" data-section="title">Structured data</h2>
      <p data-name="blurb" class="rf-feature__blurb" data-section="description">Refrakt gives you the building blocks to ship structured content sites without fighting your framework.</p>
    </header>
    <dl data-columns="3" data-name="items" class="rf-feature__items">
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Semantic runes</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Markdown primitives take on different meaning depending on the wrapping rune. Write Markdown — the rune decides what it means.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Every rune produces typed, validated content that your theme components can rely on.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Layout inheritance</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Define regions once in a parent layout. Child pages inherit and can override with prepend, append, or replace modes.</dd>
      </div>
    </dl>
  </div>
</section>

How Markdown is read

You writeIt becomes
A short paragraph, then a heading and a paragraph, before the listThe eyebrow, headline and blurb (Page sections)
A list itemA feature
Bold text in the item's first paragraphThe feature's name
An image or icon beside the nameThe feature's icon
The paragraph after the nameThe feature's description
Media, then ---, before the restA media column beside or above the features (Place the media)

Place the media

Put an image, a code sample or other media first, then ---, then the features. media-position="end" puts the media on the right and the features in a single column beside it; start puts it on the left, and top or bottom stack it with the features in a grid. media-ratio, valign and collapse tune the side-by-side split, as on card; collapse also sets the width at which a grid of features drops to one column.

{% feature media-position="end" %}
	{% codegroup %}
	```yaml title="refrakt.config.ts"
	export default {
	  content: './content',
	  theme: '@refrakt-md/lumina'
	}
	```

	```md title="content/index.md"
	---
	title: Home
	---

	{% hero %}
	# Welcome
	{% /hero %}
	```
	{% /codegroup %}

	---

	why Refrakt

	## Built for versatility

	- **Zero config**

	  Drop Markdown files into your content directory. Routing, layouts, and type generation happen automatically.

	- **Framework agnostic**

	  Render your pages with Svelte, React, Vue or plain HTML.
{% /feature %}
<section data-rune="feature" data-rune-fields="{&quot;media-position&quot;:&quot;end&quot;,&quot;layout&quot;:&quot;list&quot;,&quot;align&quot;:&quot;center&quot;}">
  <div data-name="content">
    <header>
      <p data-name="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline">Built for versatility</h2>
    </header>
    <dl data-columns="2">
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description">Drop Markdown files into your content directory. Routing, layouts, and type generation happen automatically.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description">Render your pages with Svelte, React, Vue or plain HTML.</dd>
      </div>
    </dl>
  </div>
  <div data-name="media">
    <section data-rune="code-group">
      <div role="tablist" data-name="tabs">
        <button data-name="tab" role="tab">
          <span>YAML</span>
        </button>
        <button data-name="tab" role="tab">
          <span>Md</span>
        </button>
      </div>
      <div data-name="panels">
        <div role="tabpanel" data-name="panel">
          <div class="rf-codeblock">
            <pre data-language="yaml">
              <code data-language="yaml">export default {
  content: './content',
  theme: '@refrakt-md/lumina'
}
</code>
            </pre>
          </div>
        </div>
        <div role="tabpanel" data-name="panel">
          <div class="rf-codeblock">
            <pre data-language="md">
              <code data-language="md">---
title: Home
---

{% hero %}
# Welcome
{% /hero %}
</code>
            </pre>
          </div>
        </div>
      </div>
    </section>
  </div>
</section>

why Refrakt

Built for versatility

Zero config
Drop Markdown files into your content directory. Routing, layouts, and type generation happen automatically.
Framework agnostic
Render your pages with Svelte, React, Vue or plain HTML.
export default {
  content: './content',
  theme: '@refrakt-md/lumina'
}
---
title: Home
---

{% hero %}
# Welcome
{% /hero %}
<section class="rf-feature rf-feature--center rf-feature--full" data-media-position="end" data-layout="list" data-align="center" data-width="full" data-content-measure="anchored" data-elevation="flush" data-rune="feature" data-density="full">
  <div data-name="content" class="rf-feature__content">
    <header data-name="preamble" class="rf-feature__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-feature__eyebrow" data-section="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline" class="rf-feature__headline" data-section="title">Built for versatility</h2>
    </header>
    <dl data-columns="2" data-name="items" class="rf-feature__items">
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Drop Markdown files into your content directory. Routing, layouts, and type generation happen automatically.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Render your pages with Svelte, React, Vue or plain HTML.</dd>
      </div>
    </dl>
  </div>
  <div data-name="media" class="rf-feature__media" data-section="media" data-media="cover" data-guest-fit="bleed">
    <section class="rf-codegroup rf-codegroup--scroll" data-overflow="scroll" data-elevation="flat" data-rune="code-group" data-density="compact" data-code-host="true">
      <div role="tablist" data-name="tabs" class="rf-codegroup__tabs">
        <button data-name="tab" role="tab" class="rf-codegroup__tab">
          <span>YAML</span>
        </button>
        <button data-name="tab" role="tab" class="rf-codegroup__tab">
          <span>Md</span>
        </button>
      </div>
      <div data-name="panels" class="rf-codegroup__panels">
        <div role="tabpanel" data-name="panel" class="rf-codegroup__panel">
          <div class="rf-codeblock">
            <pre data-language="yaml"><code data-language="yaml">export default {
  content: './content',
  theme: '@refrakt-md/lumina'
}
</code></pre>
          </div>
        </div>
        <div role="tabpanel" data-name="panel" class="rf-codegroup__panel">
          <div class="rf-codeblock">
            <pre data-language="md"><code data-language="md">---
title: Home
---

{% hero %}
# Welcome
{% /hero %}
</code></pre>
          </div>
        </div>
      </div>
    </section>
  </div>
</section>

Arrange the features

layout sets how the features are laid out, whatever the media does: grid tiles them, list stacks them in one column, and carousel puts them on a horizontal track that scrolls with previous and next buttons. Without layout, a feature with media beside it uses list and any other uses grid.

{% feature layout="carousel" %}

why Refrakt

## Built for versatility

- **Zero config**

  Drop Markdown files into your content directory.

- **Framework agnostic**

  Render with Svelte, React, Vue or plain HTML.

- **Type-safe output**

  Every rune produces validated content.

- **Incremental adoption**

  Add runes to existing Markdown one block at a time.
{% /feature %}
<section data-rune="feature" data-rune-fields="{&quot;media-position&quot;:&quot;bottom&quot;,&quot;layout&quot;:&quot;carousel&quot;,&quot;align&quot;:&quot;center&quot;}">
  <div data-name="content">
    <header>
      <p data-name="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline">Built for versatility</h2>
    </header>
    <dl data-columns="4">
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description">Drop Markdown files into your content directory.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description">Render with Svelte, React, Vue or plain HTML.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description">Every rune produces validated content.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Incremental adoption</span>
        </dt>
        <dd data-name="description">Add runes to existing Markdown one block at a time.</dd>
      </div>
    </dl>
  </div>
</section>

why Refrakt

Built for versatility

Zero config
Drop Markdown files into your content directory.
Framework agnostic
Render with Svelte, React, Vue or plain HTML.
Type-safe output
Every rune produces validated content.
Incremental adoption
Add runes to existing Markdown one block at a time.
<section class="rf-feature rf-feature--center rf-feature--full" data-media-position="bottom" data-layout="carousel" data-align="center" data-width="full" data-content-measure="anchored" data-elevation="flush" data-rune="feature" data-density="full">
  <div data-name="content" class="rf-feature__content">
    <header data-name="preamble" class="rf-feature__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-feature__eyebrow" data-section="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline" class="rf-feature__headline" data-section="title">Built for versatility</h2>
    </header>
    <dl data-columns="4" data-name="items" class="rf-feature__items">
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Drop Markdown files into your content directory.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Render with Svelte, React, Vue or plain HTML.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Every rune produces validated content.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Incremental adoption</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Add runes to existing Markdown one block at a time.</dd>
      </div>
    </dl>
  </div>
</section>

collapse-to="carousel" keeps a grid on wide screens and turns it into a swipeable row once the feature is narrow, instead of stacking it. The switch follows the feature's own width, so it also happens in a narrow column. Set the preview to mobile to see it:

{% feature layout="grid" collapse-to="carousel" %}

why Refrakt

## Built for versatility

- **Zero config**

  Drop Markdown files into your content directory.

- **Framework agnostic**

  Render with Svelte, React, Vue or plain HTML.

- **Type-safe output**

  Every rune produces validated content.

- **Incremental adoption**

  Add runes to existing Markdown one block at a time.
{% /feature %}
<section data-rune="feature" data-rune-fields="{&quot;media-position&quot;:&quot;bottom&quot;,&quot;layout&quot;:&quot;grid&quot;,&quot;collapse-to&quot;:&quot;carousel&quot;,&quot;align&quot;:&quot;center&quot;}">
  <div data-name="content">
    <header>
      <p data-name="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline">Built for versatility</h2>
    </header>
    <dl data-columns="4">
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description">Drop Markdown files into your content directory.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description">Render with Svelte, React, Vue or plain HTML.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description">Every rune produces validated content.</dd>
      </div>
      <div data-name="feature-item">
        <dt>
          <span data-name="title">Incremental adoption</span>
        </dt>
        <dd data-name="description">Add runes to existing Markdown one block at a time.</dd>
      </div>
    </dl>
  </div>
</section>

why Refrakt

Built for versatility

Zero config
Drop Markdown files into your content directory.
Framework agnostic
Render with Svelte, React, Vue or plain HTML.
Type-safe output
Every rune produces validated content.
Incremental adoption
Add runes to existing Markdown one block at a time.
<section class="rf-feature rf-feature--center rf-feature--full" data-media-position="bottom" data-layout="grid" data-collapse-to="carousel" data-align="center" data-width="full" data-content-measure="anchored" data-elevation="flush" data-rune="feature" data-density="full">
  <div data-name="content" class="rf-feature__content">
    <header data-name="preamble" class="rf-feature__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-feature__eyebrow" data-section="eyebrow">why Refrakt</p>
      <h2 id="built-for-versatility" data-name="headline" class="rf-feature__headline" data-section="title">Built for versatility</h2>
    </header>
    <dl data-columns="4" data-name="items" class="rf-feature__items">
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Zero config</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Drop Markdown files into your content directory.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Framework agnostic</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Render with Svelte, React, Vue or plain HTML.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Type-safe output</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Every rune produces validated content.</dd>
      </div>
      <div data-name="feature-item" class="rf-feature__feature-item">
        <dt>
          <span data-name="title">Incremental adoption</span>
        </dt>
        <dd data-name="description" class="rf-feature__description">Add runes to existing Markdown one block at a time.</dd>
      </div>
    </dl>
  </div>
</section>

Attributes

AttributeTypeRequiredDescription
align"left" | "center" | "right"—Horizontal alignment of headline and body text
layout"grid" | "list" | "carousel"—Arrangement of feature-items: grid (tiled), list (single column), or carousel (scroll-snap track). Defaults from media-position when unset.
collapse-to"stack" | "carousel"—Collapsed (mobile) form below the `collapse` breakpoint: stack (default) or carousel (a scroll-snap row).
justifystring—

Inherited from the split layout preset

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
bgstring—Background preset applied to this block
bg-fromstring—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-tostring—Gradient end colour — a semantic token name
bg-viastring—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.

AttributeTypeRequiredDescription
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)
frame

Surface chrome: a named preset from the theme registry with inline `frame-*` overrides layered on top.

AttributeTypeRequiredDescription
framestring—Named frame preset presenting this block's media surface
frame-anchorstring—Crop focal point when the guest is cut (object-position)
frame-aspectstring—Aspect ratio of the framed media, e.g. "16/9"
frame-displace"top" | "bottom" | "end" | "bottom-end" | "top-end" | "both"—Edge/corner the framed guest moves toward
frame-displace-mode"peek" | "bleed"—How displacement renders: `peek` (default) translates the guest visually inside its frame target; `bleed` uses negative margin on the media zone so following layout pulls up — extends past a section like a hero without leaving a gap above
frame-offset"none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl"—Displacement distance (non-linear named scale: sm…xl ride the block-spacing tokens, 2xl/3xl/4xl step up to section-spacing for bleed-mode displacements that clear a section edge)
frame-overflow"clip" | "bleed"—How the frame handles a guest whose content is wider than it: `clip` (default) keeps it inside the rounded frame; `bleed` runs an overflowing guest out to the layout edge on a narrow viewport so it reads as cropped by the screen (a bleed host only — hero/feature)
frame-oversizestring—How far the guest exceeds its slot (scale factor)
frame-placestring—Guest-box alignment in the slot (e.g. "left top")
frame-shadow"none" | "sm" | "md" | "lg"—Silhouette drop-shadow strength for the framed media
inset

Internal padding override.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
reveal"none" | "fade" | "slide" | "scale" | "blur"—Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography
staggerboolean—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.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
spacing"flush" | "tight" | "default" | "loose" | "breathe"—Vertical spacing above and below this block
substrate

Generated pattern fills behind the content, drawn by the theme.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
tintstring—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.

AttributeTypeRequiredDescription
width"compact" | "narrow" | "content" | "wide" | "full"—Maximum width constraint for this block
Not availableWhy
dropcap, readingthis rune declares no prose body

definition

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.

AttributeTypeRequiredDescription
bgstring—Background preset applied to this block
bg-fromstring—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-tostring—Gradient end colour — a semantic token name
bg-viastring—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.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
reveal"none" | "fade" | "slide" | "scale" | "blur"—Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography
staggerboolean—Cascade this block's items in as it reveals (no-op on single-child runes)
spacing

Block-level rhythm override.

AttributeTypeRequiredDescription
spacing"flush" | "tight" | "default" | "loose" | "breathe"—Vertical spacing above and below this block
substrate

Generated pattern fills behind the content, drawn by the theme.

AttributeTypeRequiredDescription
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.

AttributeTypeRequiredDescription
tintstring—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.

AttributeTypeRequiredDescription
width"compact" | "narrow" | "content" | "wide" | "full"—Maximum width constraint for this block
Not availableWhy
dropcap, readingthis rune declares no prose body
framethis rune declares neither a `frameTarget` nor a media section
prominencethis rune has no page-section header or featured quotation