mdast2docx logo Md2Docx
Version 0.1.0API DocsInterfaces

INodeImagePluginOptions

Updated 5 min ago

Defined in: image-node.ts:53

Properties

collapsibleHeading?

optional collapsibleHeading?: string | boolean

Defined in: image-node.ts:98

Optional heading added above fallback code blocks (H6 level, maps to Heading 5 in Word).

  • false: No heading is inserted (only the code block).
  • true: Inserts an H6 heading (###### ⚠️ Diagram Source (Render Fallback)).
  • string: Inserts custom heading text at H6 level.

Default

true

dpi?

optional dpi?: number

Defined in: image-node.ts:63

Resolution in DPI for computing physical dimensions (default: 96)

errorMode?

optional errorMode?: ImageErrorMode

Defined in: image-node.ts:74

General image error behavior.

  • "warn": Emits a styled, muted text run with alt text.
  • "silent": Drops the node completely (0 relationships, 0 XML overhead).
  • "throw": Rejects the toDocx conversion promise with the underlying Error.
  • "placeholder": Uses custom options.placeholder image. If placeholder is omitted, emits a warning badge.

Default

"warn"

fallbackImageType?

optional fallbackImageType?: "jpg" | "png" | "gif"

Defined in: image-node.ts:57

Fallback image format if original format is unsupported.

Default

"png"

imageResolver?

optional imageResolver?: NodeImageResolver

Defined in: image-node.ts:65

Optional custom resolver

maxH?

optional maxH?: number

Defined in: image-node.ts:61

Max image height in inches (default: 8)

maxW?

optional maxW?: number

Defined in: image-node.ts:59

Max image width in inches (default: 6)

mermaidFallback?

optional mermaidFallback?: MermaidFallbackMode

Defined in: image-node.ts:82

Fallback strategy specifically for failed Mermaid diagrams (when data.mermaid is present).

  • "code": Renders the raw Mermaid diagram definition as a formatted monospace code block.
  • "warn": Emits a warning badge [Mermaid Diagram Error: ...].
  • "silent": Drops the node completely.

Default

"code" (or inherits "silent" if errorMode is "silent")

pathPrefix?

optional pathPrefix?: string

Defined in: image-node.ts:55

Optional directory prefix for resolving relative local file paths

placeholder?

optional placeholder?: string

Defined in: image-node.ts:100

Custom placeholder image source (path, URL, or data URL)

svgFallback?

optional svgFallback?: SvgFallbackMode

Defined in: image-node.ts:90

Fallback strategy for failed non-Mermaid SVGs.

  • "warn": Emits styled muted text badge [Image: <alt or 'SVG unavailable'>].
  • "code": Renders the raw SVG XML markup in a standard DOCX code block (lang: "xml").
  • "silent": Drops the node completely.

Default

"warn"

On this page