Storytelling›Lore

storytelling

Lore

In-world knowledge entries for myths, prophecies, and historical records

Install

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

About the plugin and its runes

Source

import Markdoc from '@markdoc/markdoc';
const { Tag } = Markdoc;
import {
	createContentModelSchema,
	bodyOnly,
	createComponentRenderable,
	renderNodes,
} from '@refrakt-md/runes';
import { taxonomyAttributes } from './common.js';

export const loreSections = { title: 'title', body: 'body' } as const;

export const loreSchema = {
	type: 'Article',
	properties: { title: 'headline', category: 'articleSection' },
} as const;

export const lore = createContentModelSchema({
	registers: {
		entity: { idFrom: 'title', data: ['category', 'spoiler', 'tags', { name: 'title' }] },
	},
	schema: loreSchema,
	sections: loreSections,
	provides: ['prose'],
	base: taxonomyAttributes,
	attributes: {
		title: { type: String, required: true, description: 'Heading displayed for this lore entry.' },
		category: {
			type: String,
			required: false,
			description: 'Grouping label used to organize lore entries (e.g. history, magic, culture).',
		},
		spoiler: {
			type: Boolean,
			required: false,
			description: 'Enable/disable spoiler protection that hides content until revealed.',
		},
	},
	contentModel: bodyOnly(),
	transform(resolved, attrs, config) {
		const titleTag = new Tag('span', {}, [attrs.title ?? '']);
		const categoryMeta = new Tag('meta', { content: attrs.category ?? '' });
		const spoilerMeta = new Tag('meta', { content: String(attrs.spoiler ?? false) });
		const tagsMeta = new Tag('meta', { content: attrs.tags ?? '' });
		const body = renderNodes(resolved.body, config).wrap('div');

		return createComponentRenderable({
			rune: 'lore',
			tag: 'article',
			properties: {
				category: categoryMeta,
				spoiler: spoilerMeta,
				tags: tagsMeta,
			},
			refs: {
				title: titleTag,
				body: body.tag('div'),
			},
			children: [titleTag, body.next()],
		});
	},
});

View plugins/storytelling/src/tags/lore.ts on GitHub

Content is rendered directly as the lore body, with optional spoiler protection.

Basic usage

Wrap any in-world knowledge in a lore entry with a title and a category — history, magic, culture, or whatever grouping your world needs.

{% lore title="The Founding of Thornwall" category="history" %}
Three centuries ago, river traders raised a wall of thorn and stone where the river bends beneath the northern cliffs. The city that grew behind it still bears the name, and the first warden's seal still opens its gates.
{% /lore %}
<article data-rune="lore" data-rune-fields="{&quot;category&quot;:&quot;history&quot;,&quot;spoiler&quot;:&quot;false&quot;,&quot;tags&quot;:&quot;&quot;}" typeof="Article">
  <span data-name="title" property="headline">The Founding of Thornwall</span>
  <div data-name="body">
    <p>Three centuries ago, river traders raised a wall of thorn and stone where the river bends beneath the northern cliffs. The city that grew behind it still bears the name, and the first warden's seal still opens its gates.</p>
  </div>
  <meta property="articleSection" content="history">
</article>
The Founding of Thornwall

Three centuries ago, river traders raised a wall of thorn and stone where the river bends beneath the northern cliffs. The city that grew behind it still bears the name, and the first warden's seal still opens its gates.

<article class="rf-lore rf-lore--history rf-lore--false" typeof="Article" data-category="history" data-spoiler="false" data-tags="" data-elevation="flat" data-rune="lore" data-density="full">
  <span data-name="title" property="headline" class="rf-lore__title" data-section="title">The Founding of Thornwall</span>
  <div data-name="metadata" data-zone="metadata" data-zone-layout="bar" class="rf-lore__metadata">
    <span data-meta-type="category" data-field="category">history</span>
  </div>
  <div data-name="body" class="rf-lore__body" data-section="body" data-reading="prose">
    <p>Three centuries ago, river traders raised a wall of thorn and stone where the river bends beneath the northern cliffs. The city that grew behind it still bears the name, and the first warden's seal still opens its gates.</p>
  </div>
  <meta property="articleSection" content="history" />
</article>

Hide spoilers

spoiler=true hides the entry until the reader chooses to reveal it.

{% lore title="The Bone Witch's Oath" category="prophecy" spoiler=true %}
A verse scratched into the last standing wall of the Ashen Spire.

> *When the warden falls and the lanterns fade,
> the one who was cast out shall return to claim the March.*

The Silver Order reads it as a warning. Veshra reads it as a promise.
{% /lore %}
<article data-rune="lore" data-rune-fields="{&quot;category&quot;:&quot;prophecy&quot;,&quot;spoiler&quot;:&quot;true&quot;,&quot;tags&quot;:&quot;&quot;}" typeof="Article">
  <span data-name="title" property="headline">The Bone Witch's Oath</span>
  <div data-name="body">
    <p>A verse scratched into the last standing wall of the Ashen Spire.</p>
    <blockquote data-quote="quotation">
      <p>
        <em marker="*">
          When the warden falls and the lanterns fade,
          the one who was cast out shall return to claim the March.
        </em>
      </p>
    </blockquote>
    <p>The Silver Order reads it as a warning. Veshra reads it as a promise.</p>
  </div>
  <meta property="articleSection" content="prophecy">
</article>
The Bone Witch's Oath

A verse scratched into the last standing wall of the Ashen Spire.

When the warden falls and the lanterns fade, the one who was cast out shall return to claim the March.

The Silver Order reads it as a warning. Veshra reads it as a promise.

<article class="rf-lore rf-lore--prophecy rf-lore--true" typeof="Article" data-category="prophecy" data-spoiler="true" data-tags="" data-elevation="flat" data-rune="lore" data-density="full">
  <span data-name="title" property="headline" class="rf-lore__title" data-section="title">The Bone Witch's Oath</span>
  <div data-name="metadata" data-zone="metadata" data-zone-layout="bar" class="rf-lore__metadata">
    <span data-meta-type="category" data-field="category">prophecy</span>
  </div>
  <div data-name="body" class="rf-lore__body" data-section="body" data-reading="prose">
    <p>A verse scratched into the last standing wall of the Ashen Spire.</p>
    <blockquote data-quote="quotation">
      <p>
        <em marker="*">
          When the warden falls and the lanterns fade,
           
          the one who was cast out shall return to claim the March.
        </em>
      </p>
    </blockquote>
    <p>The Silver Order reads it as a warning. Veshra reads it as a promise.</p>
  </div>
  <meta property="articleSection" content="prophecy" />
</article>

Attributes

AttributeTypeRequiredDescription
titlestring✓Heading displayed for this lore entry.
categorystring—Grouping label used to organize lore entries (e.g. history, magic, culture).
spoilerboolean—Enable/disable spoiler protection that hides content until revealed.

Inherited from the storytelling taxonomy preset

AttributeTypeRequiredDescription
tagsstring—Comma-separated keywords for filtering and cross-referencing.

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)
dropcap

Per-instance drop-cap opt-in.

AttributeTypeRequiredDescription
dropcapboolean—Style the opening letter of a prose body as a drop cap. Honoured only when the body reads as prose; ignored otherwise.
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)
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)
reading

Editorial register for body text. You pick the register; the theme decides how it looks.

AttributeTypeRequiredDescription
reading"fine" | "ui" | "prose"—Reading register for this block’s body: fine | ui | prose. The theme sets how each one looks.
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
framethis rune declares neither a `frameTarget` nor a media section