mdz_contexts.ts

view source

Declarations
#

11 declarations

mdz_base_context
#

mdz_contexts.ts view source

{ get: (error_message?: string | undefined) => () => string | undefined; get_maybe: () => (() => string | undefined) | undefined; set: (value: () => string | undefined) => () => string | undefined; } import {mdz_base_context} from '@fuzdev/mdz/mdz_contexts.js';

Context for providing a base path getter for resolving relative links in mdz content. Set to a getter (e.g., () => base) so changes to the base prop are reflected without needing an effect. When the getter returns a path like '/docs/usage/', relative paths like ./grammar resolve to /docs/usage/grammar before rendering. When not set, relative paths use raw hrefs (browser resolves them).

mdz_code_context
#

mdz_contexts.ts view source

{ get: (error_message?: string | undefined) => () => MdzCodeComponent | undefined; get_maybe: () => (() => MdzCodeComponent | undefined) | undefined; set: (value: () => MdzCodeComponent | undefined) => () => MdzCodeComponent | undefined; } import {mdz_code_context} from '@fuzdev/mdz/mdz_contexts.js';

Context for overriding how inline `` code `` spans render, via a getter function. When not set, inline code renders as a plain <code> element.

mdz_codeblock_context
#

mdz_contexts.ts view source

{ get: (error_message?: string | undefined) => () => MdzCodeblockComponent | undefined; get_maybe: () => (() => MdzCodeblockComponent | undefined) | undefined; set: (value: () => MdzCodeblockComponent | undefined) => () => MdzCodeblockComponent | undefined; } import {mdz_codeblock_context} from '@fuzdev/mdz/mdz_contexts.js';

Context for overriding how fenced code blocks render, via a getter function. When not set, code blocks render as a plain <pre><code> element.

mdz_components_context
#

mdz_contexts.ts view source

{ get: (error_message?: string | undefined) => () => MdzComponents | undefined; get_maybe: () => (() => MdzComponents | undefined) | undefined; set: (value: () => MdzComponents | undefined) => () => MdzComponents | undefined; } import {mdz_components_context} from '@fuzdev/mdz/mdz_contexts.js';

Context for providing custom mdz components via a getter function. Set to a getter (e.g., () => components) so changes are reflected reactively.

mdz_elements_context
#

mdz_contexts.ts view source

{ get: (error_message?: string | undefined) => () => MdzElements | undefined; get_maybe: () => (() => MdzElements | undefined) | undefined; set: (value: () => MdzElements | undefined) => () => MdzElements | undefined; } import {mdz_elements_context} from '@fuzdev/mdz/mdz_contexts.js';

Context for providing allowed HTML elements via a getter function. Set to a getter (e.g., () => elements) so changes are reflected reactively. By default, no HTML elements are allowed.

mdz_set_context_with_fallback
#

mdz_contexts.ts view source

<T>(context: MdzGetterContext<T>, value_fn: () => T | undefined): void import {mdz_set_context_with_fallback} from '@fuzdev/mdz/mdz_contexts.js';

Set an mdz context to a getter that prefers the local value_fn and falls back to the ancestor's value when value_fn() returns undefined.

Pass value_fn as a getter (not a snapshot) so prop changes remain reactive. The ancestor lookup happens once at component init — that's intentional, it captures the surrounding scope's context at mount time.

context

type MdzGetterContext<T>

value_fn

type () => T | undefined

returns

void

generics

mdz_set_context_with_fallback<T>
T

MdzCodeblockComponent
#

mdz_contexts.ts view source

MdzCodeblockComponent import type {MdzCodeblockComponent} from '@fuzdev/mdz/mdz_contexts.js';

Component that renders a fenced code block. Receives lang and content, matching @fuzdev/fuz_code's Code, so it can be injected directly for syntax highlighting.

MdzCodeComponent
#

mdz_contexts.ts view source

MdzCodeComponent import type {MdzCodeComponent} from '@fuzdev/mdz/mdz_contexts.js';

Component that renders an inline `` code `` span. Receives the raw span content as reference — the prop name matches fuz_ui's DocsLink, so it can be injected directly to auto-link backticked API identifiers.

MdzComponents
#

mdz_contexts.ts view source

MdzComponents import type {MdzComponents} from '@fuzdev/mdz/mdz_contexts.js';

Component registry for custom Svelte components that can be used in mdz content.

For example, registering 'Alert' allows using <Alert>...</Alert> in mdz content.

The Map values are Svelte components.

MdzElements
#

mdz_contexts.ts view source

MdzElements import type {MdzElements} from '@fuzdev/mdz/mdz_contexts.js';

Element registry for HTML elements that can be used in mdz content.

For example, registering 'div' allows using <div>...</div> in mdz content.

The Map values are boolean placeholders for future configuration options.

MdzWhitespace
#

mdz_contexts.ts view source

MdzWhitespace import type {MdzWhitespace} from '@fuzdev/mdz/mdz_contexts.js';

CSS white-space values for the whitespace prop on Mdz, MdzStream, and MdzPrecompiled. By default no style is applied, so whitespace collapses like standard markdown — single newlines are soft breaks. pre-line renders every newline as a line break (chat-style input); pre-wrap additionally preserves spaces and tabs.

Depends on
#

Imported by
#