CodeHighlight.svelte

view source

Declarations
#

CodeHighlight
#

CodeHighlight.svelte view source

accepts children

import CodeHighlight from '@fuzdev/fuz_code/CodeHighlight.svelte';

lang?

type string
optional default 'svelte'

children?

type Snippet<[]> & Snippet<[markup: string]>
optional

content

The source code to syntax highlight.

type string

mode?

Highlighting mode: 'auto' uses the CSS Custom Highlight API when supported and falls back to HTML, 'ranges' forces the Highlight API (requires browser support), 'html' forces HTML generation with CSS classes. The Highlight API has limited browser support and requires theme_highlight.css instead of theme.css.

optional default 'auto'

inline?

Whether to render as inline code instead of a block.

type boolean
optional default false

wrap?

Whether to wrap long lines in block code (white-space: pre-wrap instead of pre). Wraps at whitespace — long unbroken tokens (URLs, hashes) still scroll horizontally. Ignored for inline code.

type boolean
optional default false

syntax_styler?

Custom SyntaxStyler instance, e.g. with different languages registered.

optional default syntax_styler_global

intersects

SvelteHTMLElements['code']

Depends on
#