Skip to main content

DocumentBlock

@forge/monorepo


@forge/monorepo / backend/src / DocumentBlock

Type Alias: DocumentBlock

DocumentBlock = { kind: "heading"; level: HeadingLevel; page?: number; text: string; } | { kind: "paragraph"; page?: number; text: string; } | { hasHeader: boolean; kind: "table"; page?: number; rows: readonly readonly string[][]; } | { items: readonly string[]; kind: "list"; ordered: boolean; page?: number; }

Defined in: backend/src/documents/index.ts:30

One piece of a document.

A closed union rather than a bag with optional fields: a table with no rows and a heading with no level are both unrepresentable, so a renderer never has to decide what to do about one.

Union Members

Type Literal

{ kind: "heading"; level: HeadingLevel; page?: number; text: string; }


Type Literal

{ kind: "paragraph"; page?: number; text: string; }


Type Literal

{ hasHeader: boolean; kind: "table"; page?: number; rows: readonly readonly string[][]; }

hasHeader

readonly hasHeader: boolean

kind

readonly kind: "table"

page?

readonly optional page?: number

rows

readonly rows: readonly readonly string[][]

Rows of cells. The first row is the header when hasHeader is true.


Type Literal

{ items: readonly string[]; kind: "list"; ordered: boolean; page?: number; }