Business›Organization

business

Organization

Structured business or organization information

Install

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

About the plugin and its runes

Source

import Markdoc from '@markdoc/markdoc';
import type { RenderableTreeNode } from '@markdoc/markdoc';
const { Tag } = Markdoc;
import {
	createContentModelSchema,
	createComponentRenderable,
	asNodes,
	renderNodes,
	RenderableNodeCursor,
	pageSectionProperties,
	unwrapParagraphImages,
	fieldMetas,
} from '@refrakt-md/runes';

const orgType = [
	'Organization',
	'LocalBusiness',
	'Corporation',
	'EducationalOrganization',
	'GovernmentOrganization',
	'NGO',
] as const;

const orgProperties = { headline: 'name', blurb: 'description' } as const;

export const organizationSchema = {
	by: 'type',
	rows: Object.fromEntries(
		orgType.map((type) => [type, { type, properties: orgProperties }]),
	) as Record<(typeof orgType)[number], { type: string; properties: typeof orgProperties }>,
	fallback: { type: 'Organization', properties: orgProperties },
};

export const organizationSections = {
	preamble: 'preamble',
	headline: 'title',
	blurb: 'description',
	body: 'body',
} as const;

export const organization = createContentModelSchema({
	schema: organizationSchema,
	sections: organizationSections,
	provides: ['prose'],
	attributes: {
		type: {
			type: String,
			required: false,
			matches: orgType.slice(),
			description: 'Schema.org organization category used for structured data.',
		},
	},
	contentModel: {
		type: 'sequence',
		fields: [
			{ name: 'header', match: 'heading|paragraph|image', greedy: true },
			{ name: 'body', match: 'list|blockquote|tag', greedy: true },
		],
	},
	transform(resolved, attrs, config) {
		const header = new RenderableNodeCursor(
			unwrapParagraphImages(
				Markdoc.transform(asNodes(resolved.header), config) as RenderableTreeNode[],
			),
		);
		const body = renderNodes(resolved.body, config);
		const sectionProps = pageSectionProperties(header);

		const bodyDiv = body.wrap('div');

		return createComponentRenderable({
			rune: 'organization',
			tag: 'article',
			properties: fieldMetas(attrs, config, {
				type: 'Organization',
			}),
			refs: {
				...sectionProps,
				body: bodyDiv,
			},
			children: [header.wrap('header').next(), bodyDiv.next()],
		});
	},
});

View plugins/business/src/tags/organization.ts on GitHub

A profile of a business or organization: its name, description, logo and contact details, published as structured data. To list the people in it, use cast.

Local business

A local business listing with address, hours, and contact info.

{% organization type="LocalBusiness" %}
# Acme Coffee Shop

Your neighborhood coffee shop since 2015. We serve locally roasted coffee and fresh pastries every day.

- **Address:** 123 Main St, Portland, OR 97201
- **Hours:** Mon–Fri 7am–6pm, Sat–Sun 8am–5pm
- **Phone:** (503) 555-0123
- [Website](https://acme.coffee)
{% /organization %}
<article data-rune="organization" data-rune-fields="{&quot;type&quot;:&quot;LocalBusiness&quot;}" typeof="LocalBusiness">
  <header>
    <h1 id="acme-coffee-shop" data-name="headline" property="name">Acme Coffee Shop</h1>
    <p data-name="blurb" property="description">Your neighborhood coffee shop since 2015. We serve locally roasted coffee and fresh pastries every day.</p>
  </header>
  <div data-name="body">
    <ul>
      <li>
        <strong marker="**">Address:</strong>
        123 Main St, Portland, OR 97201
      </li>
      <li>
        <strong marker="**">Hours:</strong>
        Mon–Fri 7am–6pm, Sat–Sun 8am–5pm
      </li>
      <li>
        <strong marker="**">Phone:</strong>
        (503) 555-0123
      </li>
      <li>
        <a href="https://acme.coffee">Website</a>
      </li>
    </ul>
  </div>
</article>

Acme Coffee Shop

Your neighborhood coffee shop since 2015. We serve locally roasted coffee and fresh pastries every day.

  • Address: 123 Main St, Portland, OR 97201
  • Hours: Mon–Fri 7am–6pm, Sat–Sun 8am–5pm
  • Phone: (503) 555-0123
  • Website
<article class="rf-organization" typeof="LocalBusiness" data-elevation="flat" data-rune="organization" data-density="full">
  <header data-name="preamble" class="rf-organization__preamble" data-section="preamble">
    <h1 id="acme-coffee-shop" data-name="headline" property="name" class="rf-organization__headline" data-section="title">Acme Coffee Shop</h1>
    <p data-name="blurb" property="description" class="rf-organization__blurb" data-section="description">Your neighborhood coffee shop since 2015. We serve locally roasted coffee and fresh pastries every day.</p>
  </header>
  <div data-name="body" class="rf-organization__body" data-section="body">
    <ul>
      <li>
        <strong marker="**">Address:</strong>
         123 Main St, Portland, OR 97201
      </li>
      <li>
        <strong marker="**">Hours:</strong>
         Mon–Fri 7am–6pm, Sat–Sun 8am–5pm
      </li>
      <li>
        <strong marker="**">Phone:</strong>
         (503) 555-0123
      </li>
      <li>
        <a href="https://acme.coffee">Website</a>
      </li>
    </ul>
  </div>
</article>

How Markdown is read

You writeIt becomes
A headingThe organization's name
A paragraph after the headingIts description
A short paragraph before the headingAn eyebrow above the name
An image before the listThe header image, such as a logo
A list or blockquoteThe details: address, hours, phone, links

Corporation

A corporation profile with structured data.

{% organization type="Corporation" %}
# Acme Coffee Roasters, Inc.

Roasting and selling specialty coffee from Portland, through three cafés and an online subscription.

- **Founded:** 2015
- **Headquarters:** Portland, OR
- [Website](https://acme.coffee)
- [GitHub](https://github.com/acme-coffee)
{% /organization %}
<article data-rune="organization" data-rune-fields="{&quot;type&quot;:&quot;Corporation&quot;}" typeof="Corporation">
  <header>
    <h1 id="acme-coffee-roasters-inc" data-name="headline" property="name">Acme Coffee Roasters, Inc.</h1>
    <p data-name="blurb" property="description">Roasting and selling specialty coffee from Portland, through three cafés and an online subscription.</p>
  </header>
  <div data-name="body">
    <ul>
      <li>
        <strong marker="**">Founded:</strong>
        2015
      </li>
      <li>
        <strong marker="**">Headquarters:</strong>
        Portland, OR
      </li>
      <li>
        <a href="https://acme.coffee">Website</a>
      </li>
      <li>
        <a href="https://github.com/acme-coffee">GitHub</a>
      </li>
    </ul>
  </div>
</article>

Acme Coffee Roasters, Inc.

Roasting and selling specialty coffee from Portland, through three cafés and an online subscription.

<article class="rf-organization" typeof="Corporation" data-elevation="flat" data-rune="organization" data-density="full">
  <header data-name="preamble" class="rf-organization__preamble" data-section="preamble">
    <h1 id="acme-coffee-roasters-inc" data-name="headline" property="name" class="rf-organization__headline" data-section="title">Acme Coffee Roasters, Inc.</h1>
    <p data-name="blurb" property="description" class="rf-organization__blurb" data-section="description">Roasting and selling specialty coffee from Portland, through three cafés and an online subscription.</p>
  </header>
  <div data-name="body" class="rf-organization__body" data-section="body">
    <ul>
      <li>
        <strong marker="**">Founded:</strong>
         2015
      </li>
      <li>
        <strong marker="**">Headquarters:</strong>
         Portland, OR
      </li>
      <li>
        <a href="https://acme.coffee">Website</a>
      </li>
      <li>
        <a href="https://github.com/acme-coffee">GitHub</a>
      </li>
    </ul>
  </div>
</article>

Attributes

AttributeTypeRequiredDescription
type"Organization" | "LocalBusiness" | "Corporation" | "EducationalOrganization" | "GovernmentOrganization" | "NGO"—Schema.org organization category used for structured data.

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