Package-level declarations

Types

Link copied to clipboard
@Stable
interface MermaidRenderer

Draws Mermaid source for MermaidDiagram, which supplies the card, the streaming placeholder and the full-screen viewer around it.

Link copied to clipboard
@Immutable
data class MermaidSizing(val scale: Float = 0.75f, val maxInlineHeight: Dp = 400.dp)

Size of inline diagrams, for both renderers. Mermaid lays out at 16px text, which at 1px = 1dp reads larger than body copy, so the default is 0.75.

Properties

Link copied to clipboard
val LocalMermaidRenderer: ProvidableCompositionLocal<MermaidRenderer>

The renderer every MermaidDiagram below uses.

Link copied to clipboard
val LocalMermaidSizing: ProvidableCompositionLocal<MermaidSizing>

The inline size every MermaidDiagram below uses.

Functions

Link copied to clipboard
@Composable
fun CodeBlock(code: String, language: String?, modifier: Modifier = Modifier)

A code block with a language label, copy action and syntax highlighting (computed off the main thread). Long lines scroll horizontally.

Link copied to clipboard
@Composable
fun MarkdownContent(markdown: String, modifier: Modifier = Modifier, citations: List<SourcePart> = emptyList(), streaming: Boolean = false)

Renders GitHub-flavoured Markdown with Material 3 styling.

Link copied to clipboard
@Composable
fun MathBlock(tex: String, modifier: Modifier = Modifier)

Display math rendered with the bundled, offline KaTeX (like Streamdown in AI Elements' <Response>). Falls back to the TeX source if KaTeX fails.

Link copied to clipboard
@Composable
fun MermaidDiagram(source: String, modifier: Modifier = Modifier, complete: Boolean = true)

Renders Mermaid source as a diagram. By default with the bundled, offline mermaid.js inside a transparent WebView that sizes itself to the rendered SVG; provide another MermaidRenderer through LocalMermaidRenderer (e.g. NativeMermaidRenderer from ai-elements-mermaid-native) to draw it with Compose Canvas instead.