Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Mosaic_ui.Markdown
CommonMark renderer with headings, code blocks, lists, and tables.
Markdown content display.
Parses CommonMark source via cmarkit and renders it as a tree of child Renderable.t values. Supports headings, paragraphs, code blocks, lists, blockquotes, tables, thematic breaks, and inline formatting (emphasis, strong, code spans, links, strikethrough, and task lists).
type t
The type for markdown display widgets.
Style
type style_key =
| Default
| Headingof int
(*
Level (1-3 have distinct colors; 4+ share one).
*)
| Emphasis
| Strong
| Code_span
| Code_block
| Link
| Image
| Blockquote
| Thematic_break
| List_marker
| Strikethrough
| Task_marker
| Table_border
(*
Border color for table borders.
*)
| Conceal_punctuation
(*
Style for markdown syntax markers (\*, \`, [, etc.).
*)
The type for style keys identifying markdown element classes.
create ~parent () is a markdown display widget attached to parent. With:
content: the markdown source text. Defaults to "".
style: the style resolver. Defaults to default_style.
conceal: whether to hide markdown syntax characters. When true, a link [[text](url)] is displayed as text (url). Defaults to true.
streaming: when true, incomplete trailing content is handled gracefully; the last table row is skipped to avoid flickering during incremental appends. Defaults to false.
render_node: a custom block renderer called for every Cmarkit.Block.t before default rendering. Return Some r to replace default rendering with renderable r, or None to fall through to the default. The returned renderable must be attached to parent.
render_code: a custom code block renderer called for code blocks before render_node. Receives the optional language tag and the code content. The returned renderable must be attached to parent. Use this to integrate syntax highlighting.
set_content t s replaces the markdown source of t with s and re-renders. Unchanged blocks are updated in place without destroying their renderables, making this efficient for streaming appends. No-op when s equals the current content.
set_style t f changes the style resolver of t to f and re-renders. Re-parsing is skipped when blocks already exist; leaf blocks are updated in place without destroying their renderables.
set_conceal t v sets whether t hides markdown syntax characters. Re-parsing is skipped when blocks already exist; leaf blocks are updated in place. No-op when v equals the current value.
set_streaming t v enables (true) or disables (false) streaming mode on t. When enabled, incomplete trailing table rows are skipped. No-op when v equals the current value.