Skip to main content
Anywhere a block takes text, it accepts inline content. That is a string, one inline node, or an array mixing both.
type InlineContent = string | Inline | Array<string | Inline>;

The Inline union

type Inline =
  | { type: "strong"; text: InlineContent }
  | { type: "em"; text: InlineContent }
  | { type: "strike"; text: InlineContent }
  | { type: "link"; text: InlineContent; href: string }
  | { type: "formula"; text: string }
  | { type: "code"; text: string };
strong
{ text }
Bold text, rendered as a real bold weight from the variable font.
em
{ text }
Emphasis. The bundled fonts are upright only, so emphasis renders upright. See Fonts and weights.
strike
{ text }
Struck through text.
A hyperlink to href.
formula
{ text }
Inline LaTeX. See Formulas.
code
{ text }
Inline monospace code.

Nodes nest

Inline nodes nest, so a link can contain a formula and a strong run can contain a link. The text of any node is itself inline content.
{ type: "link", href: "https://example.com", text: { type: "strong", text: "spec" } }

Markdown shortcuts

When markdown is enabled, plain strings also honor **bold**, *italic*, ~~strike~~, and $inline math$. Markdown parsing is on by default in Doc.
{ type: "paragraph", text: "Revenue grew **across every region** this quarter." }
Structured inline nodes always format regardless of the markdown flag, and they are the reliable path for generated content. Reach for markdown shortcuts in hand written prose and for structured nodes when text is assembled programmatically.

A mixed example

{
  type: "paragraph",
  text: [
    "See the ",
    { type: "link", href: "https://example.com", text: { type: "strong", text: "spec" } },
    " and the identity ",
    { type: "formula", text: "e^{i\\pi} + 1 = 0" },
    ".",
  ],
}