View as Markdown

API reference: @salmonui/rich-text

Blockinterface

import type { Block } from '@salmonui/rich-text';
interface Block {
    id: string;
    type: BlockType;
    props?: Record<string, unknown>;
    content?: InlineContent[];
    children?: Block[];
}

One block. props by type:

  • paragraph: textAlign?; heading: level (1..6), textAlign?;
  • numberedListItem: start? (starts a new numbered list); checklistItem: checked;
  • callout: tone (info | success | warning | danger | neutral);
  • code: language?; toggle: open?;
  • image: src, alt?, caption?, width?, height?;
  • audio: src; video: src, width?, height?;
  • table: headerRow (first row is header cells), rows (InlineContent[][][], rows of cells), variant? (bordered | striped).

content holds the block's own text (absent for image, table, divider, audio, video; one unmarked text item for code); children the nested blocks (list item sub-items, toggle body, quote and callout body).

Block members (5)
NameSignatureDescription
idid: string;
typetype: BlockType;
propsoptionalprops?: Record<string, unknown>;
contentoptionalcontent?: InlineContent[];
childrenoptionalchildren?: Block[];