sempdf v1.9.1Interfaces
Interface: FlowCodeOptions
sempdf / FlowCodeOptions
Defined in: src/types.ts:1356
Options for placing a preformatted code block through the flow layout API.
Unlike paragraphs, code blocks preserve leading whitespace and hard line breaks verbatim, never re-flow words between lines, and split across pages or columns line-by-line (each fragment repeats the background band).
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
background? | ColorInput | "none" | Background fill behind the block. Pass "none" to draw no background. | - | src/types.ts:1370 |
blockAlign? | BlockAlign | Alignment of the block inside the flow column. | - | src/types.ts:1435 |
blockWidth? | number | Optional width for the block within the flow column. | - | src/types.ts:1433 |
borderColor? | ColorInput | Border color. A border is drawn only when this or borderWidth is set. | - | src/types.ts:1372 |
borderWidth? | number | Border width in points. Defaults to 0.5 when borderColor is set. | - | src/types.ts:1374 |
color? | ColorInput | Code text color. Defaults to #1f2328. | - | src/types.ts:1366 |
continuationAlign? | "left" | "right" | Alignment of continuation notes within the band. Defaults to "right". | - | src/types.ts:1418 |
continuationColor? | ColorInput | Color for continuation notes. Defaults to lineNumberColor. | - | src/types.ts:1416 |
continuationFontSize? | number | Font size for continuation notes. Defaults to fontSize * 0.85. | - | src/types.ts:1414 |
continuedLabel? | string | ((info) => string) | Note drawn at the top of every fragment after the first, marking it as the continuation of a block that started on an earlier page or column. Pass a string, or a function for line-aware text. Rendered as an artifact, so it is never read as code. Off by default. Example continuedLabel: ({ firstLineNumber }) => … continued from line ${firstLineNumber - 1}`` | - | src/types.ts:1404 |
continuesLabel? | string | ((info) => string) | Note drawn at the bottom of every fragment that carries on into the next page or column. Rendered as an artifact. Off by default. Example continuesLabel: "continues on next page →" | - | src/types.ts:1412 |
fallbackFonts? | PdfFont[] | Fallback fonts used when the primary font lacks a glyph. | - | src/types.ts:1360 |
firstLineNumber? | number | Number given to the first line when lineNumbers is set. Defaults to 1. | - | src/types.ts:1388 |
font? | PdfFont | Font used to render the code. Defaults to Courier. | - | src/types.ts:1358 |
fontSize? | number | Font size in PDF points. Defaults to 9. | - | src/types.ts:1362 |
gutterGap? | number | Gap between the line-number gutter and the code, in points. Defaults to 6. | - | src/types.ts:1392 |
highlight? | readonly CodeHighlightRule[] | Regex colouring rules applied to each rendered line. | - | src/types.ts:1394 |
kerning? | boolean | Whether kerning should be applied. Defaults to false so columns align. | - | src/types.ts:1368 |
lineHeight? | number | Baseline-to-baseline distance in points. Defaults to fontSize * 1.35. | - | src/types.ts:1364 |
lineNumberColor? | ColorInput | Line-number color. Defaults to a muted grey. | - | src/types.ts:1390 |
lineNumbers? | boolean | Whether to render a line-number gutter. Defaults to false. | - | src/types.ts:1386 |
margin? | FlowMarginShorthand | CSS-like margin shorthand in PDF points. | FlowBlockSpacingOptions.margin | src/types.ts:1271 |
marginBottom? | number | Bottom margin in PDF points. | FlowBlockSpacingOptions.marginBottom | src/types.ts:1277 |
marginLeft? | number | Left margin in PDF points. | FlowBlockSpacingOptions.marginLeft | src/types.ts:1279 |
marginRight? | number | Right margin in PDF points. | FlowBlockSpacingOptions.marginRight | src/types.ts:1275 |
marginTop? | number | Top margin in PDF points. | FlowBlockSpacingOptions.marginTop | src/types.ts:1273 |
openSplitEdges? | boolean | Whether a bordered block leaves its border open where it was split — no rule along the bottom of a fragment that continues, none along the top of one that resumes — so the reader sees one listing rather than several boxes. Defaults to true. | - | src/types.ts:1425 |
padding? | number | Inner padding between the background band and the code, in points. Defaults to 8. | - | src/types.ts:1376 |
tabSize? | number | Spaces a tab expands to. Defaults to 4. | - | src/types.ts:1378 |
tag? | "P" | "Code" | "Artifact" | Structure tagging. "Code" (default) emits a P wrapper containing a Code element, "P" tags the fragment as a plain paragraph, and "Artifact" leaves the content untagged. | - | src/types.ts:1431 |
wrap? | boolean | Whether lines wider than the content width soft-wrap onto continuation lines (indented to match the wrapped line's own indentation). When false, long lines are clipped to the content width. Defaults to true. | - | src/types.ts:1384 |