sempdf
sempdf v1.9.1Interfaces

Interface: TemplateStylesheet

sempdf v1.9.1


sempdf / TemplateStylesheet

Defined in: src/types.ts:2344

Named styles applied to template blocks. Keys are either type selectors matching a block's type ("paragraph", "table", "link", "list", "code", "image", plus per-format image types like "png", and per-level headings "heading"/"heading1".."heading6") or arbitrary class names referenced by a block's class field.

A stylesheet carries the shared typographic fields only; code-specific visuals (background, padding, lineNumbers, highlight, …) belong in a TemplateCodeBlock's inline options.

Resolution cascade for each block (low to high priority): page defaults → matching type selectors (generic before specific) → each class in class order → the block's inline options. Merging is shallow.

Example

styles: {
  paragraph: { fontSize: 11, lineHeight: 16 },
  heading1: { fontSize: 24, color: rgb(0.1, 0.2, 0.5) },
  callout: { color: rgb(0.8, 0, 0), marginTop: 12 },
}

Indexable

[selector: string]: TemplateStyle | undefined

On this page