Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / emailRfmToJson

Function: emailRfmToJson()

emailRfmToJson(input): Json

Defined in: rcml/src/email/email-rfm-to-json.ts:34

Convert a full Email RFM markdown string into an RCML content JSON document.

Runs the full pipeline: parse → validate → transform → convert. Throws RcmlValidationError if the input contains syntax not allowed by the Email RFM flavor. The returned Json can be stored, sent to a Milkdown editor running the Email RFM preset, or further validated with validateJsonSemantics.

Parameters

input

string

Email RFM markdown source string.

Returns

Json

Typed RCML document JSON ({ type: 'doc', content: [...] }).

Throws

RcmlValidationError when the input is not valid Email RFM.

Example

ts
const doc = emailRfmToJson('Hello :font[world]{font-weight="bold"}')
// { type: 'doc', content: [{ type: 'paragraph', content: [...] }] }