sempdf v1.9.1Interfaces
Interface: HtmlToBlocksOptions
sempdf / HtmlToBlocksOptions
Defined in: src/internal/html-blocks.ts:50
Options controlling htmlToBlocks.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
allowedLinkSchemes? | readonly | readonly string[] | URL schemes kept on links. Defaults to http, https, mailto, and tel; every other scheme (including javascript:) renders as plain text. | src/internal/html-blocks.ts:97 |
baseFontSize? | readonly | number | Base font size used to size <small>, <sup>, and <sub> runs relative to body text. When omitted those elements only change baseline/decoration. | src/internal/html-blocks.ts:77 |
blockquoteIndent? | readonly | number | Points of left indent applied to <blockquote> content. Defaults to 18. | src/internal/html-blocks.ts:79 |
code? | readonly | FlowCodeOptions | Options applied to every generated code block (from <pre>). | src/internal/html-blocks.ts:64 |
codeFont? | readonly | PdfFont | Font used for inline <code>/<kbd>/<samp> runs. Defaults to Courier. | src/internal/html-blocks.ts:68 |
heading? | readonly | Omit<FlowHeadingOptions, "level"> | Options applied to every generated heading block (level is set per tag). | src/internal/html-blocks.ts:60 |
headingOffset? | readonly | number | Added to every heading level, so headingOffset: 1 maps <h1> to a level-2 heading (useful when the document already has its own title). Levels are clamped to 1–6. | src/internal/html-blocks.ts:56 |
imageFallback? | readonly | "alt" | "drop" | What to emit for an image with no resolved bytes. "alt" (default) renders non-empty alt text as a paragraph — alt="" marks a decorative image and is always dropped. "drop" discards the element. | src/internal/html-blocks.ts:92 |
images? | readonly | (src, attributes) => HtmlImageResolution | undefined | Resolves <img src> to bytes. Return undefined to fall back to imageFallback. Only called for elements with a src. | src/internal/html-blocks.ts:84 |
keepEmptyParagraphs? | readonly | boolean | Keeps paragraphs whose text is empty after collapsing whitespace. Defaults to false. | src/internal/html-blocks.ts:99 |
linkColor? | readonly | ColorInput | Color for <a> runs. Defaults to a link blue. | src/internal/html-blocks.ts:70 |
list? | readonly | FlowListOptions | Options applied to every generated list block. | src/internal/html-blocks.ts:62 |
normalizeText? | readonly | "ascii" | "ascii-only" | "none" | How characters the built-in fonts cannot encode are handled. Those fonts are ASCII-only, so —, , or an accented name would otherwise fail with UNSUPPORTED_CHARACTER. - "ascii" (default) folds typographic punctuation, symbols, and currency to ASCII equivalents and strips accents (Muñoz becomes Munoz). Characters with no ASCII equivalent — Devanagari, CJK, emoji — are left as they are, so they still render with an embedded font and still raise a clear error with a built-in one, rather than vanishing. - "ascii-only" does the same, then drops every remaining non-ASCII character. Lossy by design: use it when rendering must never fail and the pipeline has no embedded font. - "none" keeps the text exactly as authored. Use it with an embedded Unicode font. | src/internal/html-blocks.ts:116 |
paragraph? | readonly | FlowTextOptions | Options applied to every generated paragraph block. | src/internal/html-blocks.ts:58 |
table? | readonly | FlowTableOptions | Options applied to every generated table block. | src/internal/html-blocks.ts:66 |
underlineLinks? | readonly | boolean | Whether <a> runs are underlined. Defaults to true. | src/internal/html-blocks.ts:72 |