Skip to content
providerkit
GitHub

MarkdownProps

Defined in: react/src/markdown.tsx:109

optional highlight?: Highlighter;

Defined in: react/src/markdown.tsx:134

Highlights code blocks once they are finished. Keep its identity stable: a new function highlights every block again.


optional images?: boolean | ((image) => boolean);

Defined in: react/src/markdown.tsx:131

Whether to draw the images the model wrote. Off by default: each one is a request to an address the model chose, and its alt text is shown instead. true draws http and https images. A function decides per image.


optional labels?: Partial<MarkdownLabels>;

Defined in: react/src/markdown.tsx:140

Replaces any of defaultMarkdownLabels. Keep its identity stable, like the callbacks: a new object re-renders every link and code block.


optional linkPolicy?: (link) =>
| LinkDecision
| undefined;

Defined in: react/src/markdown.tsx:127

Decides what each link becomes, for routing inside the app or asking before leaving it. Return nothing to keep the default: a link when its scheme is allowed, its text when not. A javascript:, vbscript: or data: address, or one that starts with // and so leaves the app while looking like a path, is always text and never reaches this function. Called while drawing, so keep it fast and keep its identity stable.

Parameter Type
link MarkdownLink

| LinkDecision | undefined


optional linkSchemes?: readonly string[];

Defined in: react/src/markdown.tsx:121

The schemes a link may use. This replaces the list, so keep the defaults by spreading them: [...defaultLinkSchemes, "tel"].


optional onCitation?: (source) => void;

Defined in: react/src/markdown.tsx:137

When set, each citation is a button that calls this, for an app that shows sources in its own panel. Without it, a citation links to its source’s address.

Parameter Type
source SourcePart

void


optional sources?: readonly DisplayPart[];

Defined in: react/src/markdown.tsx:118

The message’s parts. [1] in the text becomes a citation only when one of these is a source part with marker 1; any other marker stays plain text. Other parts are ignored, so message.parts can be passed as it is.


optional streaming?: boolean;

Defined in: react/src/markdown.tsx:114

True while the text is still arriving. The last block then closes what the model has not finished yet, so raw syntax never flashes, and its code is not highlighted until it settles.


text: string;

Defined in: react/src/markdown.tsx:111

The Markdown to draw.