Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createTextContent

Function: createTextContent()

createTextContent(rfm): Json

Defined in: rcml/src/email/create-rcml-element.ts:1352

Convert an RFM markdown string into a validated content Json doc. Thin wrapper around emailRfmToJson + normalizeJson + validateJson — useful when you want the normalized + validated form up front (e.g. to pass the same content into multiple factories or to inspect the result before assembling the surrounding element).

Parameters

rfm

string

RFM markdown source string.

Returns

Json

A normalized + structurally validated Json content doc.

Throws

RcmlValidationError when the input is not valid RFM (bubbled from emailRfmToJson).

Throws

When the produced doc fails structural validation.

Example

ts
const greeting = createTextContent('Hi :font[world]{font-weight="700"}')
createTextElement({ content: greeting })