MarkdownProps

Unpublished development API. This package is under development and is not available as a published release.

Supplies the accepted Markdown snapshot to present, with parser ownership retained by the caller.

import type { MarkdownProps } from '@threadplane/react/markdown';

Declaration

export interface MarkdownProps  {
  readonly citationPreview?: boolean;
  readonly citations?: readonly Citation[];
  readonly components?: MarkdownComponents;
  readonly math?: (latex: string, options: {
        readonly display: boolean;
    }) => string | null | undefined;
  readonly snapshot: MarkdownSnapshot;
}

Members

citationPreview

Show local, connected source details instead of direct citation links.

readonly citationPreview?: boolean;

citations

Per-message source metadata; exact IDs take precedence over Markdown definitions.

readonly citations?: readonly Citation[];

components

Replaces how chosen node types render, such as 'code-block' for a highlighter. Entries win over a MarkdownComponentsProvider above, type by type; other types keep the built-in view. Define the map and its components outside render: a new component type remounts its nodes.

readonly components?: MarkdownComponents;

math

Typesets math. Called with the LaTeX between the delimiters and whether it is display math, it returns an HTML string that is inserted as markup, so return only your renderer's own output, such as KaTeX's renderToString with throwOnError: true. When it throws or returns nothing, and when it is not set, the source is shown with its delimiters. Keep it stable; a new function typesets every formula again.

readonly math?: (latex: string, options: {
        readonly display: boolean;
    }) => string | null | undefined;

snapshot

readonly snapshot: MarkdownSnapshot;