Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / FlavorConfig

Interface: FlavorConfig

Defined in: rcml/src/email/content/flavors/types.ts:26

Configuration object that fully describes a RFM markdown flavor.

Pass an instance to validate() or create flavor-specific parse functions using parseEmailRfm() / parseEmailInlineRfm() as a reference.

To add a new flavor, create a FlavorConfig — no changes to the parser or validator are required.

Example

ts
import type { FlavorConfig } from 'rcml-generator'
import { z } from 'zod'

const myFlavor: FlavorConfig = {
  name: 'My Flavor',
  allowedBlockNodes: new Set(['list', 'listItem']),
  allowedTextDirectives: new Map([['font', z.object({ 'font-weight': z.string() }).passthrough()]]),
  allowedLeafDirectives: new Map(),
  allowedContainerDirectives: new Map(),
}

Properties

allowedBlockNodes

allowedBlockNodes: ReadonlySet<string>

Defined in: rcml/src/email/content/flavors/types.ts:38

MDAST block node types allowed beyond the implicit baseline of root and paragraph (which are always permitted).

Common values: "list", "listItem", "break".


allowedContainerDirectives

allowedContainerDirectives: ReadonlyMap<string, ZodType<any, ZodTypeDef, any> | null>

Defined in: rcml/src/email/content/flavors/types.ts:62

Allowed container directives (:::name{...}) keyed by directive name.

The value is a Zod schema used to validate the directive's attributes, or null to skip attribute validation for that directive.


allowedLeafDirectives

allowedLeafDirectives: ReadonlyMap<string, ZodType<any, ZodTypeDef, any> | null>

Defined in: rcml/src/email/content/flavors/types.ts:54

Allowed leaf directives (::name{...}) keyed by directive name.

Used for inline atom directives: ::placeholder, ::loop-value. The value is a Zod schema for attribute validation, or null to skip validation.


allowedTextDirectives

allowedTextDirectives: ReadonlyMap<string, ZodType<any, ZodTypeDef, any> | null>

Defined in: rcml/src/email/content/flavors/types.ts:46

Allowed text directives (:name[...]{...}) keyed by directive name.

The value is a Zod schema used to validate the directive's attributes, or null to skip attribute validation for that directive.


name

name: string

Defined in: rcml/src/email/content/flavors/types.ts:30

Human-readable flavor name used in error messages (e.g. "Inline RFM").


singleParagraph?

optional singleParagraph?: boolean

Defined in: rcml/src/email/content/flavors/types.ts:70

When true, the document must contain exactly one paragraph. Used by Inline RFM, where multi-paragraph content is structurally invalid.

Enforced at the JSON Schema level (maxItems: 1 on doc.content).