Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createTextNode

Function: createTextNode()

createTextNode(text, marks?): TextNode

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

Create a ProseMirror text node — the simplest inline content fragment.

Use these nodes inside createInlineContent to build the content option of createTextElement / createHeadingElement / createButtonElement by hand, interleaving with placeholders and loop values.

Parameters

text

string

The raw text content.

marks?

Mark[]

Optional marks (font styling, links) applied to this run. Omit (or pass an empty array) for plain unstyled text — the returned node will have no marks field in the former case and will strip the empty array in the latter.

Returns

TextNode

A typed TextNode.

Example

ts
createTextNode('Hello')
createTextNode('bold', [{ type: 'font', attrs: { 'font-weight': '700' } }])