Places›Map

places

Map

Interactive map visualization from Markdown lists of locations

Install

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

About the plugin and its runes

Source

import Markdoc from '@markdoc/markdoc';
import type { Node } from '@markdoc/markdoc';
const { Ast, Tag } = Markdoc;
import {
	createComponentRenderable,
	createContentModelSchema,
	renderNodes,
	extractText,
	groupByHeading,
	fieldMetas,
} from '@refrakt-md/runes';

const variantType = ['street', 'satellite', 'terrain', 'dark', 'minimal'] as const;
const heightType = ['small', 'medium', 'large', 'full'] as const;
const providerType = ['openstreetmap', 'mapbox'] as const;

const COORD_PATTERN = /(-?\d+\.?\d*)\s*,\s*(-?\d+\.?\d*)/;

const SEPARATOR = /\s*[-–—]\s*/;

function parseLocationItem(node: Node): {
	name: string;
	description: string;
	lat: string;
	lng: string;
	address: string;
	url: string;
} {
	let name = '';
	let description = '';
	let url = '';

	const allNodes = Array.from(node.walk());

	for (const child of allNodes) {
		if (child.type === 'strong') {
			name = Array.from(child.walk())
				.filter((n) => n.type === 'text')
				.map((n) => n.attributes.content)
				.join('');
		} else if (child.type === 'em' && child !== node) {
			const emText = Array.from(child.walk())
				.filter((n) => n.type === 'text')
				.map((n) => n.attributes.content)
				.join('');
			if (!description) description = emText;
		} else if (child.type === 'link') {
			url = child.attributes.href || '';
		}
	}

	const fullText = extractText(node);
	let remaining = fullText;
	if (name) remaining = remaining.replace(name, '');
	if (description) remaining = remaining.replace(description, '');

	// Read the coordinates before stripping separators, so a negative sign survives.
	let lat = '';
	let lng = '';
	const coordMatch = remaining.match(COORD_PATTERN);
	if (coordMatch) {
		lat = coordMatch[1];
		lng = coordMatch[2];
		remaining = remaining.replace(COORD_PATTERN, '').trim();
	}

	remaining = remaining.replace(new RegExp(SEPARATOR.source, 'g'), ' ').trim();

	const address = remaining.replace(/\s+/g, ' ').trim();

	if (!name && !lat && !lng) {
		name = address || fullText.trim();
	} else if (!name) {
		name = address || `${lat}, ${lng}`;
	}

	return { name, description, lat, lng, address, url };
}

const mapPin = createContentModelSchema({
	attributes: {
		name: { type: String, required: false },
		description: { type: String, required: false },
		lat: { type: String, required: false },
		lng: { type: String, required: false },
		address: { type: String, required: false },
		url: { type: String, required: false },
		group: { type: String, required: false },
	},
	contentModel: {
		type: 'sequence',
		fields: [],
	},
	transform(resolved, attrs, config) {
		const nameTag = new Tag('span', {}, [attrs.name ?? '']);
		const descriptionTag = new Tag('span', {}, [attrs.description ?? '']);

		return createComponentRenderable({
			rune: 'map-pin',
			tag: 'li',
			properties: fieldMetas(attrs, config, {
				lat: '',
				lng: '',
				address: '',
				url: '',
				group: '',
			}),
			refs: {
				name: nameTag,
				description: descriptionTag,
			},
			children: [nameTag, descriptionTag],
		});
	},
});

function convertMapChildren(nodes: unknown[]): unknown[] {
	const converted: Node[] = [];

	groupByHeading(nodes as Node[], {
		initial: '',
		heading: (heading) => extractText(heading),
		item(item, group) {
			const loc = parseLocationItem(item);
			converted.push(
				new Ast.Node(
					'tag',
					{
						name: loc.name,
						description: loc.description,
						lat: loc.lat,
						lng: loc.lng,
						address: loc.address,
						url: loc.url,
						group,
					},
					[],
					'map-pin',
				),
			);
		},
		other: (node) => converted.push(node),
	});

	return converted;
}

export { mapPin };

export const map = createContentModelSchema({
	attributes: {
		zoom: {
			type: String,
			required: false,
			description: 'Initial zoom level of the map (higher values zoom in closer).',
		},
		center: {
			type: String,
			required: false,
			description: 'Coordinates to center the map on (e.g. "48.8566, 2.3522").',
		},
		variant: {
			type: String,
			required: false,
			matches: variantType.slice(),
			description: 'Visual style of the map tiles: street, satellite, terrain, dark, or minimal.',
		},
		height: {
			type: String,
			required: false,
			matches: heightType.slice(),
			description: 'Vertical size of the map container: small, medium, large, or full.',
		},
		provider: {
			type: String,
			required: false,
			matches: providerType.slice(),
			description: 'Tile provider used for rendering: openstreetmap or mapbox.',
		},
		interactive: {
			type: Boolean,
			required: false,
			description: 'Enable or disable pan and zoom interaction on the map.',
		},
		route: {
			type: Boolean,
			required: false,
			description: 'Enable or disable drawing a route line between pins.',
		},
		cluster: {
			type: Boolean,
			required: false,
			description: 'Enable or disable grouping nearby pins into clusters at low zoom.',
		},
	},
	contentModel: {
		type: 'custom',
		processChildren: convertMapChildren,
		description:
			'Parses list items into map-pin tags with bold names, italic descriptions, ' +
			'link URLs, coordinate regex extraction, and heading-based grouping.',
	},
	transform(resolved, attrs, config) {
		const body = renderNodes(resolved.children, config);

		const zoomMeta = new Tag('meta', { content: attrs.zoom ?? '' });
		const centerMeta = new Tag('meta', { content: attrs.center ?? '' });
		const variantMeta = new Tag('meta', { content: attrs.variant ?? 'street' });
		const heightMeta = new Tag('meta', { content: attrs.height ?? 'medium' });
		const providerMeta = new Tag('meta', { content: attrs.provider ?? 'openstreetmap' });
		const interactiveMeta = new Tag('meta', { content: String(attrs.interactive ?? true) });
		const routeMeta = new Tag('meta', { content: String(attrs.route ?? false) });
		const clusterMeta = new Tag('meta', { content: String(attrs.cluster ?? false) });

		const pins = body.tag('li').typeof('MapPin');
		const pinsList = new Tag('ol', {}, pins.toArray());

		const node = createComponentRenderable({
			rune: 'map',
			tag: 'div',
			properties: {
				zoom: zoomMeta,
				center: centerMeta,
				variant: variantMeta,
				height: heightMeta,
				provider: providerMeta,
				interactive: interactiveMeta,
				route: routeMeta,
				cluster: clusterMeta,
				pin: pins,
			},
			refs: { pins: pinsList },
			children: [pinsList],
		});
		node.name = 'rf-map';
		return node;
	},
});

View plugins/places/src/tags/map.ts on GitHub

Transform lists of locations into interactive maps. Supports named pins with coordinates or addresses, route lines, and grouped layers.

Simple pins

List items with coordinates become map pins. Bold text sets the pin name, italic text adds a description.

{% map zoom="13" center="48.8566, 2.3522" %}
- **Louvre Museum** - *World's largest art museum* - 48.8606, 2.3376
- **Eiffel Tower** - *Iconic iron lattice tower* - 48.8584, 2.2945
- **Notre-Dame** - *Medieval Catholic cathedral* - 48.8530, 2.3499
{% /map %}
<rf-map data-rune="map" data-rune-fields="{&quot;zoom&quot;:&quot;13&quot;,&quot;center&quot;:&quot;48.8566, 2.3522&quot;,&quot;variant&quot;:&quot;street&quot;,&quot;height&quot;:&quot;medium&quot;,&quot;provider&quot;:&quot;openstreetmap&quot;,&quot;interactive&quot;:&quot;true&quot;,&quot;route&quot;:&quot;false&quot;,&quot;cluster&quot;:&quot;false&quot;}">
  <ol data-name="pins">
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;48.8606&quot;,&quot;lng&quot;:&quot;2.3376&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Louvre Museum</span>
      <span data-name="description">World's largest art museum</span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;48.8584&quot;,&quot;lng&quot;:&quot;2.2945&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Eiffel Tower</span>
      <span data-name="description">Iconic iron lattice tower</span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;48.8530&quot;,&quot;lng&quot;:&quot;2.3499&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Notre-Dame</span>
      <span data-name="description">Medieval Catholic cathedral</span>
    </li>
  </ol>
</rf-map>
  1. Louvre MuseumWorld's largest art museum
  2. Eiffel TowerIconic iron lattice tower
  3. Notre-DameMedieval Catholic cathedral
<rf-map class="rf-map rf-map--street rf-map--medium" data-variant="street" data-height="medium" data-zoom="13" data-center="48.8566, 2.3522" data-provider="openstreetmap" data-interactive="true" data-route="false" data-cluster="false" data-elevation="flush" data-rune="map" data-density="compact">
  <div data-name="container" class="rf-map__container">
    <ol data-name="pins" class="rf-map__pins">
      <li class="rf-map-pin" data-field="pin" data-lat="48.8606" data-lng="2.3376" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Louvre Museum</span>
        <span data-name="description" class="rf-map-pin__description">World's largest art museum</span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="48.8584" data-lng="2.2945" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Eiffel Tower</span>
        <span data-name="description" class="rf-map-pin__description">Iconic iron lattice tower</span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="48.8530" data-lng="2.3499" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Notre-Dame</span>
        <span data-name="description" class="rf-map-pin__description">Medieval Catholic cathedral</span>
      </li>
    </ol>
  </div>
</rf-map>

How Markdown is read

You writeIt becomes
A list itemA pin
Bold text in the itemThe pin's name
Italic text in the itemThe pin's description, shown in its popup
Coordinates such as 48.8606, 2.3376The pin's position
An address instead of coordinatesA pin placed by looking the address up
A headingA group of pins, shown as a layer the reader can toggle

Route

Ordered lists with route=true draw a connecting line between pins.

{% map route=true variant="terrain" %}
- **Portland** - 45.5152, -122.6784
- **Crater Lake** - 42.8684, -122.1685
- **Redwood National Park** - 41.2132, -124.0046
- **San Francisco** - 37.7749, -122.4194
{% /map %}
<rf-map data-rune="map" data-rune-fields="{&quot;zoom&quot;:&quot;&quot;,&quot;center&quot;:&quot;&quot;,&quot;variant&quot;:&quot;terrain&quot;,&quot;height&quot;:&quot;medium&quot;,&quot;provider&quot;:&quot;openstreetmap&quot;,&quot;interactive&quot;:&quot;true&quot;,&quot;route&quot;:&quot;true&quot;,&quot;cluster&quot;:&quot;false&quot;}">
  <ol data-name="pins">
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;45.5152&quot;,&quot;lng&quot;:&quot;-122.6784&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Portland</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;42.8684&quot;,&quot;lng&quot;:&quot;-122.1685&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Crater Lake</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;41.2132&quot;,&quot;lng&quot;:&quot;-124.0046&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Redwood National Park</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;37.7749&quot;,&quot;lng&quot;:&quot;-122.4194&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">San Francisco</span>
      <span data-name="description"></span>
    </li>
  </ol>
</rf-map>
  1. Portland
  2. Crater Lake
  3. Redwood National Park
  4. San Francisco
<rf-map class="rf-map rf-map--terrain rf-map--medium" data-variant="terrain" data-height="medium" data-zoom="" data-center="" data-provider="openstreetmap" data-interactive="true" data-route="true" data-cluster="false" data-elevation="flush" data-rune="map" data-density="compact">
  <div data-name="container" class="rf-map__container">
    <ol data-name="pins" class="rf-map__pins">
      <li class="rf-map-pin" data-field="pin" data-lat="45.5152" data-lng="-122.6784" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Portland</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="42.8684" data-lng="-122.1685" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Crater Lake</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="41.2132" data-lng="-124.0046" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Redwood National Park</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="37.7749" data-lng="-122.4194" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">San Francisco</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
    </ol>
  </div>
</rf-map>

Grouped layers

Headings create pin groups that can be toggled as map layers.

{% map zoom="12" center="51.5074, -0.1278" %}
## Restaurants
- **Dishoom** - 51.5114, -0.1263
- **Bao** - 51.5133, -0.1375

## Museums
- **Tate Modern** - 51.5076, -0.0994
- **V&A** - 51.4966, -0.1722
{% /map %}
<rf-map data-rune="map" data-rune-fields="{&quot;zoom&quot;:&quot;12&quot;,&quot;center&quot;:&quot;51.5074, -0.1278&quot;,&quot;variant&quot;:&quot;street&quot;,&quot;height&quot;:&quot;medium&quot;,&quot;provider&quot;:&quot;openstreetmap&quot;,&quot;interactive&quot;:&quot;true&quot;,&quot;route&quot;:&quot;false&quot;,&quot;cluster&quot;:&quot;false&quot;}">
  <ol data-name="pins">
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;51.5114&quot;,&quot;lng&quot;:&quot;-0.1263&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;Restaurants&quot;}" data-field="pin">
      <span data-name="name">Dishoom</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;51.5133&quot;,&quot;lng&quot;:&quot;-0.1375&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;Restaurants&quot;}" data-field="pin">
      <span data-name="name">Bao</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;51.5076&quot;,&quot;lng&quot;:&quot;-0.0994&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;Museums&quot;}" data-field="pin">
      <span data-name="name">Tate Modern</span>
      <span data-name="description"></span>
    </li>
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;51.4966&quot;,&quot;lng&quot;:&quot;-0.1722&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;Museums&quot;}" data-field="pin">
      <span data-name="name">V&amp;A</span>
      <span data-name="description"></span>
    </li>
  </ol>
</rf-map>
  1. Dishoom
  2. Bao
  3. Tate Modern
  4. V&A
<rf-map class="rf-map rf-map--street rf-map--medium" data-variant="street" data-height="medium" data-zoom="12" data-center="51.5074, -0.1278" data-provider="openstreetmap" data-interactive="true" data-route="false" data-cluster="false" data-elevation="flush" data-rune="map" data-density="compact">
  <div data-name="container" class="rf-map__container">
    <ol data-name="pins" class="rf-map__pins">
      <li class="rf-map-pin" data-field="pin" data-lat="51.5114" data-lng="-0.1263" data-address="" data-url="" data-group="Restaurants" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Dishoom</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="51.5133" data-lng="-0.1375" data-address="" data-url="" data-group="Restaurants" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Bao</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="51.5076" data-lng="-0.0994" data-address="" data-url="" data-group="Museums" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Tate Modern</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
      <li class="rf-map-pin" data-field="pin" data-lat="51.4966" data-lng="-0.1722" data-address="" data-url="" data-group="Museums" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">V&amp;A</span>
        <span data-name="description" class="rf-map-pin__description"></span>
      </li>
    </ol>
  </div>
</rf-map>

Height variants

Control the map height with the height attribute: small, medium (the default), large, or full. A single pin needs little room:

{% map height="small" zoom="15" %}
- **Tate Modern** - *Modern art in a former power station* - 51.5076, -0.0994
{% /map %}
<rf-map data-rune="map" data-rune-fields="{&quot;zoom&quot;:&quot;15&quot;,&quot;center&quot;:&quot;&quot;,&quot;variant&quot;:&quot;street&quot;,&quot;height&quot;:&quot;small&quot;,&quot;provider&quot;:&quot;openstreetmap&quot;,&quot;interactive&quot;:&quot;true&quot;,&quot;route&quot;:&quot;false&quot;,&quot;cluster&quot;:&quot;false&quot;}">
  <ol data-name="pins">
    <li data-rune="map-pin" data-rune-fields="{&quot;lat&quot;:&quot;51.5076&quot;,&quot;lng&quot;:&quot;-0.0994&quot;,&quot;address&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;group&quot;:&quot;&quot;}" data-field="pin">
      <span data-name="name">Tate Modern</span>
      <span data-name="description">Modern art in a former power station</span>
    </li>
  </ol>
</rf-map>
  1. Tate ModernModern art in a former power station
<rf-map class="rf-map rf-map--street rf-map--small" data-variant="street" data-height="small" data-zoom="15" data-center="" data-provider="openstreetmap" data-interactive="true" data-route="false" data-cluster="false" data-elevation="flush" data-rune="map" data-density="compact">
  <div data-name="container" class="rf-map__container">
    <ol data-name="pins" class="rf-map__pins">
      <li class="rf-map-pin" data-field="pin" data-lat="51.5076" data-lng="-0.0994" data-address="" data-url="" data-group="" data-rune="map-pin" data-density="full">
        <span data-name="name" class="rf-map-pin__name">Tate Modern</span>
        <span data-name="description" class="rf-map-pin__description">Modern art in a former power station</span>
      </li>
    </ol>
  </div>
</rf-map>

Attributes

AttributeTypeRequiredDescription
zoomstring—Initial zoom level of the map (higher values zoom in closer).
centerstring—Coordinates to center the map on (e.g. "48.8566, 2.3522").
variant"street" | "satellite" | "terrain" | "dark" | "minimal"—Visual style of the map tiles: street, satellite, terrain, dark, or minimal.
height"small" | "medium" | "large" | "full"—Vertical size of the map container: small, medium, large, or full.
provider"openstreetmap" | "mapbox"—Tile provider used for rendering: openstreetmap or mapbox.
interactiveboolean—Enable or disable pan and zoom interaction on the map.
routeboolean—Enable or disable drawing a route line between pins.
clusterboolean—Enable or disable grouping nearby pins into clusters at low zoom.

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

map-pin

AttributeTypeRequiredDescription
namestring—
descriptionstring—
latstring—
lngstring—
addressstring—
urlstring—
groupstring—

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