Skip to content
Lamina PDF
0.9.0
GitHub
Open the web app

BlockSpec

type BlockSpec =
| {
align?: AlignSpec | null;
breakBefore?: boolean;
keepWithNext?: boolean;
level?: number | null;
lineHeight?: number | null;
orphans?: number | null;
spaceAfter?: number | null;
spaceBefore?: number | null;
spans?: SpanSpec[] | null;
style?: string | null;
text?: Text | null;
type: "paragraph";
widows?: number | null;
}
| {
align?: AlignSpec | null;
breakBefore?: boolean;
keepWithNext?: boolean;
level?: number | null;
lineHeight?: number | null;
orphans?: number | null;
spaceAfter?: number | null;
spaceBefore?: number | null;
spans?: SpanSpec[] | null;
style?: string | null;
text?: Text | null;
type: "heading";
widows?: number | null;
}
| {
indent?: number | null;
items: ListItemSpec[];
kind: ListKindSpec;
start?: number | null;
style?: string | null;
type: "list";
}
| {
alt: Text;
image: string;
type: "figure";
width?: number | null;
}
| {
height: number;
type: "spacer";
}
| {
type: "pageBreak";
}
| {
blocks: BlockSpec[];
type: "keep";
}
| {
columns: ColumnSpec[];
footer?: RowSpec[];
frame?: RuleSpec | null;
header?: RowSpec[];
headerBackground?: string | null;
headerRule?: RuleSpec | null;
padding?: number | null;
rowRules?: RuleSpec | null;
rows?: RowSpec[];
spaceAfter?: number | null;
spaceBefore?: number | null;
type: "table";
}
| {
indent?: number | null;
levels?: number | null;
style?: string | null;
type: "contents";
}
| {
blocks: BlockSpec[];
type: "quote";
}
| {
style?: string | null;
text: Text;
type: "codeBlock";
}
| {
type: "rule";
};

Defined in: packages/sdk/src/generated/document.ts:16

One block of the flow, tagged by type.

{
align?: AlignSpec | null;
breakBefore?: boolean;
keepWithNext?: boolean;
level?: number | null;
lineHeight?: number | null;
orphans?: number | null;
spaceAfter?: number | null;
spaceBefore?: number | null;
spans?: SpanSpec[] | null;
style?: string | null;
text?: Text | null;
type: "paragraph";
widows?: number | null;
}
align?: AlignSpec | null;

Where the lines sit.

breakBefore?: boolean;

Start it on a new page.

keepWithNext?: boolean;

Keep it on the page of the next block.

level?: number | null;

The heading’s level, 1 to 6: needed by a heading, refused on a paragraph.

lineHeight?: number | null;

The space between lines, as a factor of the size (1.2 when left out).

orphans?: number | null;

The fewest lines of the paragraph left at the foot of a page before it breaks (2 when left out).

spaceAfter?: number | null;

Points of space below.

spaceBefore?: number | null;

Points of space above.

spans?: SpanSpec[] | null;

The text as spans; give this or text.

style?: string | null;

The style of text, and of spans that name none (body when left out).

text?: Text | null;

The text, in style; give this or spans.

type: "paragraph";
widows?: number | null;

The fewest lines of the paragraph carried to the top of a new page (2 when left out).


{
align?: AlignSpec | null;
breakBefore?: boolean;
keepWithNext?: boolean;
level?: number | null;
lineHeight?: number | null;
orphans?: number | null;
spaceAfter?: number | null;
spaceBefore?: number | null;
spans?: SpanSpec[] | null;
style?: string | null;
text?: Text | null;
type: "heading";
widows?: number | null;
}
align?: AlignSpec | null;

Where the lines sit.

breakBefore?: boolean;

Start it on a new page.

keepWithNext?: boolean;

Keep it on the page of the next block.

level?: number | null;

The heading’s level, 1 to 6: needed by a heading, refused on a paragraph.

lineHeight?: number | null;

The space between lines, as a factor of the size (1.2 when left out).

orphans?: number | null;

The fewest lines of the paragraph left at the foot of a page before it breaks (2 when left out).

spaceAfter?: number | null;

Points of space below.

spaceBefore?: number | null;

Points of space above.

spans?: SpanSpec[] | null;

The text as spans; give this or text.

style?: string | null;

The style of text, and of spans that name none (body when left out).

text?: Text | null;

The text, in style; give this or spans.

type: "heading";
widows?: number | null;

The fewest lines of the paragraph carried to the top of a new page (2 when left out).


{
indent?: number | null;
items: ListItemSpec[];
kind: ListKindSpec;
start?: number | null;
style?: string | null;
type: "list";
}
indent?: number | null;

Points the items are indented.

items: ListItemSpec[];

The items.

kind: ListKindSpec;

bullet or numbered.

start?: number | null;

The first number of a numbered list (1 when left out).

style?: string | null;

The markers’ style (body when left out).

type: "list";

{
alt: Text;
image: string;
type: "figure";
width?: number | null;
}
alt: Text;

Its alternate text, which a screen reader reads.

image: string;

An image given beside the document, by name.

type: "figure";
width?: number | null;

Its width in points (the body’s width at most; its own size when left out).


{
height: number;
type: "spacer";
}
height: number;

Its height in points.

type: "spacer";

{
type: "pageBreak";
}

{
blocks: BlockSpec[];
type: "keep";
}
blocks: BlockSpec[];

The blocks.

type: "keep";

{
columns: ColumnSpec[];
footer?: RowSpec[];
frame?: RuleSpec | null;
header?: RowSpec[];
headerBackground?: string | null;
headerRule?: RuleSpec | null;
padding?: number | null;
rowRules?: RuleSpec | null;
rows?: RowSpec[];
spaceAfter?: number | null;
spaceBefore?: number | null;
type: "table";
}
columns: ColumnSpec[];

One width per column.

footer?: RowSpec[];

The footer rows, kept with the last body row.

frame?: RuleSpec | null;

A rule around the table.

header?: RowSpec[];

The header rows, repeated on each page the table runs onto.

headerBackground?: string | null;

The header rows’ background, as #rrggbb.

headerRule?: RuleSpec | null;

A rule under the header.

padding?: number | null;

Points of space inside each cell.

rowRules?: RuleSpec | null;

A rule between body rows.

rows?: RowSpec[];

The body rows; a row is never split between pages.

spaceAfter?: number | null;

Points of space below the table.

spaceBefore?: number | null;

Points of space above the table.

type: "table";

{
indent?: number | null;
levels?: number | null;
style?: string | null;
type: "contents";
}
indent?: number | null;

Points each level below the first is indented.

levels?: number | null;

The deepest heading level it lists, 1 to 6 (2 when left out).

style?: string | null;

The entries’ style (body when left out).

type: "contents";

{
blocks: BlockSpec[];
type: "quote";
}
blocks: BlockSpec[];

The blocks.

type: "quote";

{
style?: string | null;
text: Text;
type: "codeBlock";
}
style?: string | null;

Its style (body when left out).

text: Text;

The code.

type: "codeBlock";

{
type: "rule";
}

0.2.0