Storytelling›Bond

storytelling

Bond

Relationship connections between characters or entities

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';

export const bondSections = { body: 'body' } as const;

export const bond = createContentModelSchema({
	registers: {
		edge: {
			from: 'from',
			to: 'to',
			kind: { field: 'bondType' },
			bidirectional: { field: 'bidirectional' },
			data: ['bondType', 'status', 'bidirectional'],
		},
	},
	sections: bondSections,
	provides: ['prose'],
	attributes: {
		from: {
			type: String,
			required: true,
			description: 'Name of the first character or entity in this bond.',
		},
		to: {
			type: String,
			required: true,
			description: 'Name of the second character or entity in this bond.',
		},
		type: {
			type: String,
			required: false,
			description: 'Kind of relationship (e.g. ally, rival, mentor, sibling).',
		},
		status: {
			type: String,
			required: false,
			description: 'Current state of the bond (e.g. active, broken, strained).',
		},
		bidirectional: {
			type: Boolean,
			required: false,
			description: 'Enable/disable mutual connection between both entities.',
		},
	},
	contentModel: bodyOnly(),
	transform(resolved, attrs, config) {
		const fromTag = new Tag('span', {}, [attrs.from ?? '']);
		const toTag = new Tag('span', {}, [attrs.to ?? '']);
		const connector = new Tag('div', { 'data-name': 'connector' }, [
			new Tag('span', { 'data-name': 'arrow' }),
		]);
		const bondTypeMeta = new Tag('meta', { content: attrs.type ?? '' });
		const statusMeta = new Tag('meta', { content: attrs.status ?? 'active' });
		const bidirectionalMeta = new Tag('meta', { content: String(attrs.bidirectional ?? true) });
		const body = renderNodes(resolved.body, config).wrap('div');

		return createComponentRenderable({
			rune: 'bond',
			tag: 'div',
			properties: {
				bondType: bondTypeMeta,
				status: statusMeta,
				bidirectional: bidirectionalMeta,
			},
			refs: {
				from: fromTag,
				to: toTag,
				connector,
				body: body.tag('div'),
			},
			children: [fromTag, connector, toTag, body.next()],
		});
	},
});

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

Content within the rune describes the nature and history of the relationship.

Basic usage

Define a relationship between two entities with a type and status.

{% bond from="Elena" to="Veshra" type="rival" status="strained" %}
They studied side by side at the Ashen Spire until Veshra turned to necromancy. Elena still keeps the letters they wrote each other, and still hopes to bring her back.
{% /bond %}
<div data-rune="bond" data-rune-fields="{&quot;bondType&quot;:&quot;rival&quot;,&quot;status&quot;:&quot;strained&quot;,&quot;bidirectional&quot;:&quot;true&quot;}">
  <span data-name="from">Elena</span>
  <div data-name="connector">
    <span data-name="arrow"></span>
  </div>
  <span data-name="to">Veshra</span>
  <div data-name="body">
    <p>They studied side by side at the Ashen Spire until Veshra turned to necromancy. Elena still keeps the letters they wrote each other, and still hopes to bring her back.</p>
  </div>
</div>
Elena
Veshra

They studied side by side at the Ashen Spire until Veshra turned to necromancy. Elena still keeps the letters they wrote each other, and still hopes to bring her back.

<div class="rf-bond rf-bond--rival rf-bond--strained rf-bond--true" data-bond-type="rival" data-status="strained" data-bidirectional="true" data-elevation="flat" data-rune="bond" data-density="full">
  <span data-name="from" class="rf-bond__from">Elena</span>
  <div data-name="connector" class="rf-bond__connector">
    <span data-name="arrow" class="rf-bond__arrow"></span>
  </div>
  <span data-name="to" class="rf-bond__to">Veshra</span>
  <div data-name="body" class="rf-bond__body" data-section="body">
    <p>They studied side by side at the Ashen Spire until Veshra turned to necromancy. Elena still keeps the letters they wrote each other, and still hopes to bring her back.</p>
  </div>
</div>

One-directional bonds

Set bidirectional to false for one-way relationships like mentorship or unrequited feelings.

{% bond from="Veshra" to="Elena" type="obsession" status="active" bidirectional=false %}
Veshra has followed Elena's every move since the Spire fell, through informants in the Whispering Hand. Elena has no idea.
{% /bond %}
<div data-rune="bond" data-rune-fields="{&quot;bondType&quot;:&quot;obsession&quot;,&quot;status&quot;:&quot;active&quot;,&quot;bidirectional&quot;:&quot;false&quot;}">
  <span data-name="from">Veshra</span>
  <div data-name="connector">
    <span data-name="arrow"></span>
  </div>
  <span data-name="to">Elena</span>
  <div data-name="body">
    <p>Veshra has followed Elena's every move since the Spire fell, through informants in the Whispering Hand. Elena has no idea.</p>
  </div>
</div>
Veshra
Elena

Veshra has followed Elena's every move since the Spire fell, through informants in the Whispering Hand. Elena has no idea.

<div class="rf-bond rf-bond--obsession rf-bond--active rf-bond--false" data-bond-type="obsession" data-status="active" data-bidirectional="false" data-elevation="flat" data-rune="bond" data-density="full">
  <span data-name="from" class="rf-bond__from">Veshra</span>
  <div data-name="connector" class="rf-bond__connector">
    <span data-name="arrow" class="rf-bond__arrow"></span>
  </div>
  <span data-name="to" class="rf-bond__to">Elena</span>
  <div data-name="body" class="rf-bond__body" data-section="body">
    <p>Veshra has followed Elena's every move since the Spire fell, through informants in the Whispering Hand. Elena has no idea.</p>
  </div>
</div>

In the relationship graph

Every bond is also an edge in the site's relationship graph, with its type as the edge kind (bond when it has none). relationships lists it on both characters' pages, or only on the from side when bidirectional is false. from and to may name a character by any of its aliases. A bond whose from or to names no character, realm, faction, lore or plot is reported as a build warning and left out of the graph.

Attributes

AttributeTypeRequiredDescription
fromstring✓Name of the first character or entity in this bond.
tostring✓Name of the second character or entity in this bond.
typestring—Kind of relationship (e.g. ally, rival, mentor, sibling).
statusstring—Current state of the bond (e.g. active, broken, strained).
bidirectionalboolean—Enable/disable mutual connection between both entities.

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)
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
prominencethis rune has no page-section header or featured quotation