Skip to content

font

A mark that applies typographic styling to a text node. All attributes are optional — set only the ones you need. At least one attribute must be present; a bare font mark with no attributes is invalid.

Attributes

AttributeDefaultConstraintExampleDescription
font-familynullCSS font-family string"Arial, sans-serif"The font face.
font-sizenullCSS length"14px"The font size.
line-heightnullCSS line-height value"1.5"Line spacing.
letter-spacingnullCSS length"0.05em"Character spacing.
font-stylenull"normal" | "italic""italic"Italic toggle.
font-weightnullCSS font-weight or "bold""bold"Bold toggle.
text-decorationnull"none" | "underline" | "line-through""underline"Underline or strikethrough.
colornullCSS color value"#e74c3c"Text colour.

Applies to

Available in

  • Full Email RFM (rc-text, rc-heading)
  • Email Inline RFM (rc-button)

JSON

Bold text:

json
{
  "type": "text",
  "text": "Bold",
  "marks": [{ "type": "font", "attrs": { "font-weight": "bold" } }]
}

Bold, italic, and coloured text — multiple attributes on one mark:

json
{
  "type": "text",
  "text": "Styled",
  "marks": [
    {
      "type": "font",
      "attrs": {
        "font-weight": "bold",
        "font-style": "italic",
        "color": "#e74c3c"
      }
    }
  ]
}

The Email RFM converter emits null for every unset attribute. Programmatically constructed JSON may omit unset attributes instead.

Email RFM syntax

Use the :font[text]{…} span directive. Include only the attributes you want to set.

:font[bold text]{font-weight="bold"}

:font[italic text]{font-style="italic"}

:font[bold and italic]{font-weight="bold" font-style="italic"}

:font[coloured]{color="#e74c3c"}

:font[underlined]{text-decoration="underline"}

:font[custom font]{font-family="Georgia, serif" font-size="18px"}