Skip to Content
Md2Docx logo Md2Docx

ICodeLowlightOptions

Updated 10 Nov 2026

Defined in: packages/code-lowlight/src/code-lowlight.ts:16

Configuration options for the code plugin.

Extends

Properties

blockType?

optional blockType?: "table" | "paragraph"

Defined in: packages/code/src/types.ts:126

Block presentation type when lineNumbers is false:

  • "table": renders a padded single-cell table with background shading and border.
  • "paragraph": renders as a native shaded Paragraph.

Default

"table"

Inherited from

ICodePluginOptions.blockType

customThemes?

optional customThemes?: Record<string, Partial<ICodeTheme>>

Defined in: packages/code/src/types.ts:88

Additional custom themes catalog mapped by name.

Inherited from

ICodePluginOptions.customThemes

diffHighlight?

optional diffHighlight?: boolean

Defined in: packages/code/src/types.ts:138

Whether to detect and style git diff additions and deletions.

Default

true

Inherited from

ICodePluginOptions.diffHighlight

fontFamily?

optional fontFamily?: string

Defined in: packages/code/src/types.ts:112

Monospace font family for code blocks and inline code runs.

Default

"Consolas"

Inherited from

ICodePluginOptions.fontFamily

fontSize?

optional fontSize?: number

Defined in: packages/code/src/types.ts:118

Font size in half-points (e.g. 19 = 9.5pt, 20 = 10pt, 24 = 12pt).

Default

19

Inherited from

ICodePluginOptions.fontSize

gutterStart?

optional gutterStart?: number

Defined in: packages/code/src/types.ts:100

Starting line number for gutter.

Default

1

Inherited from

ICodePluginOptions.gutterStart

gutterWidthPercent?

optional gutterWidthPercent?: number

Defined in: packages/code/src/types.ts:106

Width percentage allocated to gutter column when lineNumbers is true. Auto-calculated based on line count if not specified.

Inherited from

ICodePluginOptions.gutterWidthPercent

highlightAuto?

optional highlightAuto?: boolean

Defined in: packages/code-lowlight/src/code-lowlight.ts:27

Whether to automatically detect language when the requested language is not registered.

Default

true

highlightInline?

optional highlightInline?: boolean

Defined in: packages/code/src/types.ts:132

Whether to intercept and highlight inlineCode MDAST nodes.

Default

true

Inherited from

ICodePluginOptions.highlightInline

lineNumbers?

optional lineNumbers?: boolean

Defined in: packages/code/src/types.ts:94

Whether to display line numbers in a gutter column.

Default

false

Inherited from

ICodePluginOptions.lineNumbers

lowlight?

optional lowlight?: object

Defined in: packages/code-lowlight/src/code-lowlight.ts:21

Custom lowlight instance with registered language grammars. Defaults to createLowlight(common).

highlight

highlight: (language, value, options?) => Root

Parameters
language

string

value

string

options?

Readonly<Options> | null

Returns

Root

highlightAuto

highlightAuto: (value, options?) => Root

Parameters
value

string

options?

Readonly<AutoOptions> | null

Returns

Root

listLanguages

listLanguages: () => string[]

Returns

string[]

register

register: \{(grammars): undefined; (name, grammar?): undefined; \}

Call Signature

(grammars): undefined

Register languages.

Parameters
grammars

Readonly<Record<string, LanguageFn>>

Returns

undefined

Example
  import {createLowlight} from 'lowlight'
  import xml from 'highlight.js/lib/languages/xml'

  const lowlight = createLowlight()

  lowlight.register({xml})

  // Note: `html` is an alias for `xml`.
  console.log(lowlight.highlight('html', '<em>Emphasis</em>'))

Yields:

{type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
Call Signature

(name, grammar?): undefined

Register languages.

Parameters
name

string

grammar?

LanguageFn

Returns

undefined

Example
  import {createLowlight} from 'lowlight'
  import xml from 'highlight.js/lib/languages/xml'

  const lowlight = createLowlight()

  lowlight.register({xml})

  // Note: `html` is an alias for `xml`.
  console.log(lowlight.highlight('html', '<em>Emphasis</em>'))

Yields:

{type: 'root', children: [Array], data: {language: 'html', relevance: 2}}

registerAlias

registerAlias: \{(aliases): undefined; (language, alias?): undefined; \}

Call Signature

(aliases): undefined

Register aliases.

Parameters
aliases

Readonly<Record<string, ReadonlyArray<string> | string>>

Returns

undefined

Example
  import {createLowlight} from 'lowlight'
  import markdown from 'highlight.js/lib/languages/markdown'

  const lowlight = createLowlight()

  lowlight.register({markdown})

  // lowlight.highlight('mdown', '<em>Emphasis</em>')
  // ^ would throw: Error: Unknown language: `mdown` is not registered

  lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
  lowlight.highlight('mdown', '<em>Emphasis</em>')
  // ^ Works!
Call Signature

(language, alias?): undefined

Register aliases.

Parameters
language

string

alias?

string | readonly string[]

Returns

undefined

Example
  import {createLowlight} from 'lowlight'
  import markdown from 'highlight.js/lib/languages/markdown'

  const lowlight = createLowlight()

  lowlight.register({markdown})

  // lowlight.highlight('mdown', '<em>Emphasis</em>')
  // ^ would throw: Error: Unknown language: `mdown` is not registered

  lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
  lowlight.highlight('mdown', '<em>Emphasis</em>')
  // ^ Works!

registered

registered: (aliasOrName) => boolean

Parameters
aliasOrName

string

Returns

boolean

tabSize?

optional tabSize?: number

Defined in: packages/code/src/types.ts:144

Number of spaces to replace tab (\t) characters with.

Default

2

Inherited from

ICodePluginOptions.tabSize

theme?

optional theme?: PresetThemeName | string & object | ICodeTheme

Defined in: packages/code/src/types.ts:83

Active theme name or custom theme object.

Default

"github-light"

Inherited from

ICodePluginOptions.theme

tokenizer?

optional tokenizer?: (code, language?) => Token[][]

Defined in: packages/code/src/types.ts:149

Optional custom tokenizer override.

Parameters

code

string

language?

string

Returns

Token[][]

Inherited from

ICodePluginOptions.tokenizer

On this page