sempdf
sempdf v1.9.1Interfaces

Interface: HtmlToBlocksOptions

sempdf v1.9.1


sempdf / HtmlToBlocksOptions

Defined in: src/internal/html-blocks.ts:50

Options controlling htmlToBlocks.

Properties

PropertyModifierTypeDescriptionDefined in
allowedLinkSchemes?readonlyreadonly 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?readonlynumberBase 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?readonlynumberPoints of left indent applied to <blockquote> content. Defaults to 18.src/internal/html-blocks.ts:79
code?readonlyFlowCodeOptionsOptions applied to every generated code block (from <pre>).src/internal/html-blocks.ts:64
codeFont?readonlyPdfFontFont used for inline <code>/<kbd>/<samp> runs. Defaults to Courier.src/internal/html-blocks.ts:68
heading?readonlyOmit<FlowHeadingOptions, "level">Options applied to every generated heading block (level is set per tag).src/internal/html-blocks.ts:60
headingOffset?readonlynumberAdded 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 | undefinedResolves <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?readonlybooleanKeeps paragraphs whose text is empty after collapsing whitespace. Defaults to false.src/internal/html-blocks.ts:99
linkColor?readonlyColorInputColor for <a> runs. Defaults to a link blue.src/internal/html-blocks.ts:70
list?readonlyFlowListOptionsOptions 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 &mdash;, &nbsp;, 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?readonlyFlowTextOptionsOptions applied to every generated paragraph block.src/internal/html-blocks.ts:58
table?readonlyFlowTableOptionsOptions applied to every generated table block.src/internal/html-blocks.ts:66
underlineLinks?readonlybooleanWhether <a> runs are underlined. Defaults to true.src/internal/html-blocks.ts:72

On this page