Learning›Recipe

learning

Recipe

Structured recipe with ingredients, steps, and chef tips

Install

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

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 } = Markdoc;
import {
	createContentModelSchema,
	createComponentRenderable,
	asNodes,
	RenderableNodeCursor,
	SplitLayoutModel,
	pageSectionProperties,
	buildLayoutMetas,
	extractMediaImage,
	withoutQuoteRole,
} from '@refrakt-md/runes';

const difficultyType = ['easy', 'medium', 'hard'] as const;

export const recipeSections = {
	preamble: 'preamble',
	headline: 'title',
	blurb: 'description',
	media: 'media',
} as const;
export const recipeMediaSlots = { media: 'cover' } as const;

export const recipeSchema = {
	type: 'Recipe',
	properties: {
		headline: 'name',
		blurb: 'description',
		prepTime: 'prepTime',
		cookTime: 'cookTime',
		servings: 'recipeYield',
		mediaImage: 'image',
		ingredient: 'recipeIngredient',
	},
	children: {
		step: {
			type: 'HowToStep',
			property: 'recipeInstructions',
			text: { step: 'text' },
			textTag: 'p',
		},
	},
} as const;

export const recipe = createContentModelSchema({
	schema: recipeSchema,
	sections: recipeSections,
	mediaSlots: recipeMediaSlots,
	base: SplitLayoutModel,
	attributes: {
		prepTime: {
			type: String,
			required: false,
			default: '',
			description: 'Time needed for preparation before cooking (e.g. "15 min")',
		},
		cookTime: {
			type: String,
			required: false,
			default: '',
			description: 'Active cooking or baking time (e.g. "45 min")',
		},
		servings: {
			type: Number,
			required: false,
			description: 'Number of portions the recipe yields',
		},
		difficulty: {
			type: String,
			required: false,
			matches: difficultyType.slice(),
			default: 'medium',
			description: 'Skill level: easy, medium, or hard',
		},
		'content-place': {
			type: String,
			required: false,
			description: 'Cover overlay anchor: "<block> <inline>" (e.g. "end start") or "auto"',
		},
	},
	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: 'ingredients',
						match: 'list:unordered',
						optional: true,
						template: '- Ingredient',
					},
					{ name: 'steps', match: 'list:ordered', optional: true, template: '1. Step' },
					{ name: 'tips', match: 'blockquote', greedy: true, optional: true },
				],
			},
		],
	},
	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 ingredientsRendered = Markdoc.transform(
			contentZone.ingredients ? [contentZone.ingredients as Node] : [],
			config,
		) as RenderableTreeNode[];
		const ingredients: any[] = [];
		for (const node of ingredientsRendered) {
			if (Markdoc.Tag.isTag(node) && node.name === 'ul') {
				ingredients.push(...(node.children || []));
			}
		}

		const stepsRendered = Markdoc.transform(
			contentZone.steps ? [contentZone.steps as Node] : [],
			config,
		) as RenderableTreeNode[];
		const steps: any[] = [];
		for (const node of stepsRendered) {
			if (Markdoc.Tag.isTag(node) && node.name === 'ol') {
				steps.push(...(node.children || []));
			}
		}

		const tipsRendered = Markdoc.transform(
			asNodes(contentZone.tips),
			config,
		) as RenderableTreeNode[];
		const tips = tipsRendered
			.filter((n: any) => Markdoc.Tag.isTag(n) && n.name === 'blockquote')
			.map(withoutQuoteRole);

		const mediaAstNodes = (Array.isArray(mediaZone.media) ? mediaZone.media : []) as Node[];
		const side = new RenderableNodeCursor(
			Markdoc.transform(mediaAstNodes, config) as RenderableTreeNode[],
		);

		const prepTimeMeta = new Tag('meta', { content: attrs.prepTime });
		const cookTimeMeta = new Tag('meta', { content: attrs.cookTime });
		const servingsMeta = new Tag('meta', {
			content: attrs.servings != null ? String(attrs.servings) : '',
		});
		const difficultyMeta = new Tag('meta', { content: attrs.difficulty });

		for (const li of ingredients) {
			if (Markdoc.Tag.isTag(li)) li.attributes['data-name'] = 'ingredient';
		}
		for (const li of steps) {
			if (Markdoc.Tag.isTag(li)) li.attributes['data-name'] = 'step';
		}

		const { metas: layoutMetas } = buildLayoutMetas(attrs);
		const {
			mediaPosition: mediaPositionMeta,
			mediaRatio: mediaRatioMeta,
			valign: valignMeta,
			collapse: collapseMeta,
		} = layoutMetas;

		const contentPlace = attrs['content-place'] as string | undefined;
		const contentPlaceMeta = contentPlace ? new Tag('meta', { content: contentPlace }) : undefined;

		const sectionProps = pageSectionProperties(header);
		const ingredientsList = new Tag('ul', {}, ingredients);
		const stepsList = new Tag('ol', {}, steps);
		const tipsDiv = new Tag('div', {}, tips);

		const mediaImgTag = extractMediaImage(side);
		const mediaCursor = mediaImgTag ? new RenderableNodeCursor([mediaImgTag]) : side;
		const mediaDiv = mediaCursor.wrap('div');
		const hasMedia = mediaCursor.toArray().length > 0;

		const seoImage = mediaImgTag;

		const children: any[] = [
			...(hasMedia ? [mediaDiv.next()] : []),
			...header.toArray(),
			ingredientsList,
			stepsList,
			...(tips.length > 0 ? [tipsDiv] : []),
		];

		return createComponentRenderable({
			rune: 'recipe',
			tag: 'article',
			properties: {
				prepTime: prepTimeMeta,
				cookTime: cookTimeMeta,
				servings: servingsMeta,
				difficulty: difficultyMeta,
				'media-position': mediaPositionMeta,
				'media-ratio': mediaRatioMeta,
				valign: valignMeta,
				collapse: collapseMeta,
				'content-place': contentPlaceMeta,
			},
			refs: {
				...sectionProps,
				ingredients: ingredientsList,
				steps: stepsList,
				tips: tipsDiv,
				media: mediaDiv,
				mediaImage: seoImage,
			},
			children,
		});
	},
});

View plugins/learning/src/tags/recipe.ts on GitHub

A recipe: its ingredients, method, timings and tips, published as structured data.

Basic usage

A complete recipe with ingredients, instructions, and a tip.

{% recipe prepTime="PT15M" cookTime="PT30M" servings=4 difficulty="easy" %}
# Classic Pasta Carbonara

A rich and creamy Italian pasta dish.

- 400g spaghetti
- 200g pancetta
- 4 egg yolks
- 100g Pecorino Romano
- Black pepper to taste

1. Cook pasta in salted boiling water until al dente
2. Fry pancetta in a large pan until crispy
3. Whisk egg yolks with grated cheese and pepper
4. Toss hot pasta with pancetta, then stir in egg mixture off the heat

> The residual heat from the pasta cooks the eggs — never add eggs directly to a hot pan or they will scramble.
{% /recipe %}
<article data-rune="recipe" data-rune-fields="{&quot;prepTime&quot;:&quot;PT15M&quot;,&quot;cookTime&quot;:&quot;PT30M&quot;,&quot;servings&quot;:&quot;4&quot;,&quot;difficulty&quot;:&quot;easy&quot;,&quot;media-position&quot;:&quot;top&quot;}" typeof="Recipe">
  <h1 id="classic-pasta-carbonara" data-name="headline" property="name">Classic Pasta Carbonara</h1>
  <p data-name="blurb" property="description">A rich and creamy Italian pasta dish.</p>
  <ul data-name="ingredients">
    <li data-name="ingredient" property="recipeIngredient">400g spaghetti</li>
    <li data-name="ingredient" property="recipeIngredient">200g pancetta</li>
    <li data-name="ingredient" property="recipeIngredient">4 egg yolks</li>
    <li data-name="ingredient" property="recipeIngredient">100g Pecorino Romano</li>
    <li data-name="ingredient" property="recipeIngredient">Black pepper to taste</li>
  </ul>
  <ol data-name="steps">
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Cook pasta in salted boiling water until al dente</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Fry pancetta in a large pan until crispy</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Whisk egg yolks with grated cheese and pepper</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Toss hot pasta with pancetta, then stir in egg mixture off the heat</p>
    </li>
  </ol>
  <div data-name="tips">
    <blockquote>
      <p>The residual heat from the pasta cooks the eggs — never add eggs directly to a hot pan or they will scramble.</p>
    </blockquote>
  </div>
  <meta property="prepTime" content="PT15M">
  <meta property="cookTime" content="PT30M">
  <meta property="recipeYield" content="4">
</article>

Classic Pasta Carbonara

A rich and creamy Italian pasta dish.

  • 400g spaghetti
  • 200g pancetta
  • 4 egg yolks
  • 100g Pecorino Romano
  • Black pepper to taste
  1. 1

    Cook pasta in salted boiling water until al dente

  2. 2

    Fry pancetta in a large pan until crispy

  3. 3

    Whisk egg yolks with grated cheese and pepper

  4. 4

    Toss hot pasta with pancetta, then stir in egg mixture off the heat

The residual heat from the pasta cooks the eggs — never add eggs directly to a hot pan or they will scramble.

<article class="rf-recipe rf-recipe--easy" typeof="Recipe" data-media-position="top" data-prep-time="PT15M" data-cook-time="PT30M" data-servings="4" data-difficulty="easy" data-elevation="flat" data-rune="recipe" data-density="full">
  <div data-name="content" class="rf-recipe__content">
    <header data-name="preamble" class="rf-recipe__preamble" data-section="preamble">
      <h1 id="classic-pasta-carbonara" data-name="headline" property="name" class="rf-recipe__headline" data-section="title">Classic Pasta Carbonara</h1>
      <p data-name="blurb" property="description" class="rf-recipe__blurb" data-section="description">A rich and creamy Italian pasta dish.</p>
    </header>
    <dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-recipe__metadata">
      <div data-name="row" data-field="prepTime" class="rf-recipe__row">
        <dt data-meta-label="">Prep</dt>
        <dd>
          <span data-meta-type="temporal">15m</span>
        </dd>
      </div>
      <div data-name="row" data-field="cookTime" class="rf-recipe__row">
        <dt data-meta-label="">Cook</dt>
        <dd>
          <span data-meta-type="temporal">30m</span>
        </dd>
      </div>
      <div data-name="row" data-field="servings" class="rf-recipe__row">
        <dt data-meta-label="">Serves</dt>
        <dd>
          <span data-meta-type="quantity">4</span>
        </dd>
      </div>
      <div data-name="row" data-field="difficulty" class="rf-recipe__row">
        <dt data-meta-label="">Difficulty</dt>
        <dd>
          <span data-meta-type="category" data-meta-sentiment="positive">easy</span>
        </dd>
      </div>
    </dl>
    <ul data-name="ingredients" class="rf-recipe__ingredients">
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">400g spaghetti</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">200g pancetta</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">4 egg yolks</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">100g Pecorino Romano</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">Black pepper to taste</li>
    </ul>
    <ol data-name="steps" data-sequence="numbered" class="rf-recipe__steps">
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">1</span>
        <p property="text">Cook pasta in salted boiling water until al dente</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">2</span>
        <p property="text">Fry pancetta in a large pan until crispy</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">3</span>
        <p property="text">Whisk egg yolks with grated cheese and pepper</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">4</span>
        <p property="text">Toss hot pasta with pancetta, then stir in egg mixture off the heat</p>
      </li>
    </ol>
    <div data-name="tips" class="rf-recipe__tips">
      <blockquote>
        <p>The residual heat from the pasta cooks the eggs — never add eggs directly to a hot pan or they will scramble.</p>
      </blockquote>
    </div>
  </div>
  <meta property="prepTime" content="PT15M" />
  <meta property="cookTime" content="PT30M" />
  <meta property="recipeYield" content="4" />
</article>

How Markdown is read

You writeIt becomes
A short paragraph, then a heading and a paragraphThe eyebrow, the recipe's name and its description (Page sections)
A bulleted listThe ingredients
A numbered listThe steps
A blockquoteA tip
An image, then ---, before everything elseThe recipe's photo

Place the media

The body splits on --- into media → content zones (media first in source). media-position controls visual placement independently of source order.

media-ratio, valign and collapse tune a side-by-side split, as on card.

Cover mode

media-position="cover" turns the recipe into a poster: the title block (eyebrow, headline, blurb) overlays the media as a header, and the ingredients, steps, and tips flow below on the page palette. Recipe uses header scope — only the preamble sits on the image, never the long body — so it's the same one-attribute switch as on card, scoped to the part that belongs on the photo.

{% recipe prepTime="PT5M" servings=1 difficulty="easy" media-position="cover" scrim-type="frost" scrim-blur="md" %}
![A tequila sunrise cocktail](https://assets.refrakt.md/tequila-sunrise.png)

---

A cocktail classic

## Tequila Sunrise

A layered showstopper that transitions from deep orange to golden yellow — like watching the sun come up in a glass.

- 60ml tequila
- 120ml fresh orange juice
- 15ml grenadine
- Orange slice and cherry for garnish

1. Fill a tall glass with ice and pour in the tequila and orange juice. Stir gently.
2. Slowly pour grenadine over the back of a spoon so it sinks to the bottom.
3. Let the layers settle, then garnish with an orange slice and a cherry.
{% /recipe %}
<article data-rune="recipe" data-rune-fields="{&quot;prepTime&quot;:&quot;PT5M&quot;,&quot;cookTime&quot;:&quot;&quot;,&quot;servings&quot;:&quot;1&quot;,&quot;difficulty&quot;:&quot;easy&quot;,&quot;media-position&quot;:&quot;cover&quot;}" typeof="Recipe">
  <div data-name="media">
    <img src="https://assets.refrakt.md/tequila-sunrise.png" alt="A tequila sunrise cocktail" data-name="mediaImage" property="image">
  </div>
  <p data-name="eyebrow">A cocktail classic</p>
  <h2 id="tequila-sunrise" data-name="headline" property="name">Tequila Sunrise</h2>
  <p data-name="blurb" property="description">A layered showstopper that transitions from deep orange to golden yellow — like watching the sun come up in a glass.</p>
  <ul data-name="ingredients">
    <li data-name="ingredient" property="recipeIngredient">60ml tequila</li>
    <li data-name="ingredient" property="recipeIngredient">120ml fresh orange juice</li>
    <li data-name="ingredient" property="recipeIngredient">15ml grenadine</li>
    <li data-name="ingredient" property="recipeIngredient">Orange slice and cherry for garnish</li>
  </ul>
  <ol data-name="steps">
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Fill a tall glass with ice and pour in the tequila and orange juice. Stir gently.</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Slowly pour grenadine over the back of a spoon so it sinks to the bottom.</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Let the layers settle, then garnish with an orange slice and a cherry.</p>
    </li>
  </ol>
  <meta property="prepTime" content="PT5M">
  <meta property="recipeYield" content="1">
  <meta data-field="scrim-type" content="frost">
  <meta data-field="scrim-blur" content="md">
</article>
A tequila sunrise cocktail

A cocktail classic

Tequila Sunrise

A layered showstopper that transitions from deep orange to golden yellow — like watching the sun come up in a glass.

  • 60ml tequila
  • 120ml fresh orange juice
  • 15ml grenadine
  • Orange slice and cherry for garnish
  1. 1

    Fill a tall glass with ice and pour in the tequila and orange juice. Stir gently.

  2. 2

    Slowly pour grenadine over the back of a spoon so it sinks to the bottom.

  3. 3

    Let the layers settle, then garnish with an orange slice and a cherry.

<article class="rf-recipe rf-recipe--easy rf-recipe--cover" typeof="Recipe" data-media-position="cover" data-prep-time="PT5M" data-cook-time="" data-servings="1" data-difficulty="easy" data-elevation="flat" data-scrim-type="frost" data-scrim-blur="md" data-rune="recipe" data-density="full" data-cover-scope="header">
  <div data-name="cover-band" data-color-scheme="dark" class="rf-recipe__cover-band">
    <div data-name="media" class="rf-recipe__media" data-section="media" data-media="cover" data-guest-fit="clip" data-guest-posture="presentational">
      <img src="https://assets.refrakt.md/tequila-sunrise.png" alt="A tequila sunrise cocktail" data-name="mediaImage" property="image" class="rf-recipe__mediaImage" />
    </div>
    <header data-name="preamble" class="rf-recipe__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-recipe__eyebrow">A cocktail classic</p>
      <h2 id="tequila-sunrise" data-name="headline" property="name" class="rf-recipe__headline" data-section="title">Tequila Sunrise</h2>
      <p data-name="blurb" property="description" class="rf-recipe__blurb" data-section="description">A layered showstopper that transitions from deep orange to golden yellow — like watching the sun come up in a glass.</p>
    </header>
  </div>
  <div data-name="content" class="rf-recipe__content">
    <dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-recipe__metadata">
      <div data-name="row" data-field="prepTime" class="rf-recipe__row">
        <dt data-meta-label="">Prep</dt>
        <dd>
          <span data-meta-type="temporal">5m</span>
        </dd>
      </div>
      <div data-name="row" data-field="servings" class="rf-recipe__row">
        <dt data-meta-label="">Serves</dt>
        <dd>
          <span data-meta-type="quantity">1</span>
        </dd>
      </div>
      <div data-name="row" data-field="difficulty" class="rf-recipe__row">
        <dt data-meta-label="">Difficulty</dt>
        <dd>
          <span data-meta-type="category" data-meta-sentiment="positive">easy</span>
        </dd>
      </div>
    </dl>
    <ul data-name="ingredients" class="rf-recipe__ingredients">
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">60ml tequila</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">120ml fresh orange juice</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">15ml grenadine</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">Orange slice and cherry for garnish</li>
    </ul>
    <ol data-name="steps" data-sequence="numbered" class="rf-recipe__steps">
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">1</span>
        <p property="text">Fill a tall glass with ice and pour in the tequila and orange juice. Stir gently.</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">2</span>
        <p property="text">Slowly pour grenadine over the back of a spoon so it sinks to the bottom.</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">3</span>
        <p property="text">Let the layers settle, then garnish with an orange slice and a cherry.</p>
      </li>
    </ol>
  </div>
  <meta property="prepTime" content="PT5M" />
  <meta property="recipeYield" content="1" />
</article>

The cover scrim, content-place anchor, and scrim-type="frost" work exactly as on card — here the frosted band reads behind the title while the metadata and method below stay on the normal surface. Only the overlaid header flips to a light foreground; the body keeps the page palette.

Card vs hero

A recipe is a bordered card by default. The same recipe becomes a full-bleed hero by composing the three surface axes — elevation="flush" drops the card chrome, width="full" takes it edge-to-edge, and prominence="display" scales the title up — with no rune fork:

{% recipe prepTime="PT5M" servings=1 difficulty="easy" elevation="flush" width="full" prominence="display" %}
![A tequila sunrise cocktail](https://assets.refrakt.md/tequila-sunrise.png)

---

A cocktail classic

## Tequila Sunrise

A layered showstopper that runs from deep orange to golden yellow.

- 60ml tequila
- 120ml fresh orange juice
- 15ml grenadine

1. Fill a tall glass with ice; pour in tequila and orange juice.
2. Pour grenadine over the back of a spoon so it sinks.
{% /recipe %}
<article data-rune="recipe" data-rune-fields="{&quot;prepTime&quot;:&quot;PT5M&quot;,&quot;cookTime&quot;:&quot;&quot;,&quot;servings&quot;:&quot;1&quot;,&quot;difficulty&quot;:&quot;easy&quot;,&quot;media-position&quot;:&quot;top&quot;}" typeof="Recipe" width="full" elevation="flush" prominence="display">
  <div data-name="media">
    <img src="https://assets.refrakt.md/tequila-sunrise.png" alt="A tequila sunrise cocktail" data-name="mediaImage" property="image">
  </div>
  <p data-name="eyebrow">A cocktail classic</p>
  <h2 id="tequila-sunrise" data-name="headline" property="name">Tequila Sunrise</h2>
  <p data-name="blurb" property="description">A layered showstopper that runs from deep orange to golden yellow.</p>
  <ul data-name="ingredients">
    <li data-name="ingredient" property="recipeIngredient">60ml tequila</li>
    <li data-name="ingredient" property="recipeIngredient">120ml fresh orange juice</li>
    <li data-name="ingredient" property="recipeIngredient">15ml grenadine</li>
  </ul>
  <ol data-name="steps">
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Fill a tall glass with ice; pour in tequila and orange juice.</p>
    </li>
    <li data-name="step" typeof="HowToStep" property="recipeInstructions">
      <p property="text">Pour grenadine over the back of a spoon so it sinks.</p>
    </li>
  </ol>
  <meta property="prepTime" content="PT5M">
  <meta property="recipeYield" content="1">
</article>
A tequila sunrise cocktail

A cocktail classic

Tequila Sunrise

A layered showstopper that runs from deep orange to golden yellow.

  • 60ml tequila
  • 120ml fresh orange juice
  • 15ml grenadine
  1. 1

    Fill a tall glass with ice; pour in tequila and orange juice.

  2. 2

    Pour grenadine over the back of a spoon so it sinks.

<article class="rf-recipe rf-recipe--easy rf-recipe--full" typeof="Recipe" data-media-position="top" data-prep-time="PT5M" data-cook-time="" data-servings="1" data-difficulty="easy" data-width="full" data-elevation="flush" data-prominence="display" data-rune="recipe" data-density="full">
  <div data-name="media" class="rf-recipe__media" data-section="media" data-media="cover" data-guest-fit="clip">
    <img src="https://assets.refrakt.md/tequila-sunrise.png" alt="A tequila sunrise cocktail" data-name="mediaImage" property="image" class="rf-recipe__mediaImage" />
  </div>
  <div data-name="content" class="rf-recipe__content">
    <header data-name="preamble" class="rf-recipe__preamble" data-section="preamble">
      <p data-name="eyebrow" class="rf-recipe__eyebrow">A cocktail classic</p>
      <h2 id="tequila-sunrise" data-name="headline" property="name" class="rf-recipe__headline" data-section="title">Tequila Sunrise</h2>
      <p data-name="blurb" property="description" class="rf-recipe__blurb" data-section="description">A layered showstopper that runs from deep orange to golden yellow.</p>
    </header>
    <dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-recipe__metadata">
      <div data-name="row" data-field="prepTime" class="rf-recipe__row">
        <dt data-meta-label="">Prep</dt>
        <dd>
          <span data-meta-type="temporal">5m</span>
        </dd>
      </div>
      <div data-name="row" data-field="servings" class="rf-recipe__row">
        <dt data-meta-label="">Serves</dt>
        <dd>
          <span data-meta-type="quantity">1</span>
        </dd>
      </div>
      <div data-name="row" data-field="difficulty" class="rf-recipe__row">
        <dt data-meta-label="">Difficulty</dt>
        <dd>
          <span data-meta-type="category" data-meta-sentiment="positive">easy</span>
        </dd>
      </div>
    </dl>
    <ul data-name="ingredients" class="rf-recipe__ingredients">
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">60ml tequila</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">120ml fresh orange juice</li>
      <li data-name="ingredient" property="recipeIngredient" class="rf-recipe__ingredient">15ml grenadine</li>
    </ul>
    <ol data-name="steps" data-sequence="numbered" class="rf-recipe__steps">
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">1</span>
        <p property="text">Fill a tall glass with ice; pour in tequila and orange juice.</p>
      </li>
      <li data-name="step" typeof="HowToStep" property="recipeInstructions" class="rf-recipe__step">
        <span data-name="ordinal" data-meta-type="quantity" class="rf-recipe__ordinal">2</span>
        <p property="text">Pour grenadine over the back of a spoon so it sinks.</p>
      </li>
    </ol>
  </div>
  <meta property="prepTime" content="PT5M" />
  <meta property="recipeYield" content="1" />
</article>

This differs from cover mode above: cover overlays the title on the image (a poster), while the hero stacks a display-size title above an edge-to-edge image. Both are one-line switches on the same content. See Surfaces → Card vs hero for the full axis reference.

Attributes

AttributeTypeRequiredDescription
prepTimestring—Time needed for preparation before cooking (e.g. "15 min")
cookTimestring—Active cooking or baking time (e.g. "45 min")
servingsnumber—Number of portions the recipe yields
difficulty"easy" | "medium" | "hard"—Skill level: easy, medium, or hard
content-placestring—Cover overlay anchor: "<block> <inline>" (e.g. "end start") or "auto"

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