Skip to main content

Markdown Rendering Support

The MarkdownNode renders GFM (GitHub Flavored Markdown) directly to a Skia Picture using pulldown-cmark's event stream and Skia's textlayout::Paragraph API. No HTML/CSS pipeline is involved — the markdown source is walked and drawn in a single pass.

  • Parser: pulldown-cmark 0.13 with ENABLE_STRIKETHROUGH | ENABLE_TABLES | ENABLE_TASKLISTS | ENABLE_MATH
  • Renderer: crates/grida/src/painter/markdown.rs
  • Node schema: MarkdownNodeRec in crates/grida/src/node/schema.rs
  • Theme: GitHub markdown light (hardcoded colors from fixtures/css/github-markdown-light.css)

Block Elements​

ElementStatusNotes
Heading h1✅32px semi-bold, bottom border
Heading h2✅24px semi-bold, bottom border
Heading h3✅20px semi-bold
Heading h4✅16px semi-bold
Heading h5✅14px semi-bold
Heading h6✅13.5px semi-bold
Paragraph✅Word-wrapped to content width
Code block✅Monospace, rounded background rect + border
Code block (lang)⚠️Language tag parsed but no syntax highlighting
Blockquote✅Left border + indented text
Horizontal rule✅2px stroke line
Unordered list✅Bullet prefix, nested depth tracked
Ordered list✅Numbered prefix, auto-incrementing
Task list✅Checkbox character prefix (☐/☑)
Display math $$⚠️Rendered as centered monospace italic text (raw LaTeX source)

Inline Elements​

ElementStatusNotes
Bold✅Font weight BOLD
Italic✅Font slant Italic
Strikethrough✅LINE_THROUGH decoration
Inline code✅Monospace font, 0.85x font size
Link✅Blue color + underline decoration
Inline math $⚠️Rendered as monospace italic text (raw LaTeX)
Soft break✅Collapsed to space
Hard break✅Newline character

Tables​

FeatureStatusNotes
Basic table✅Equal-width columns, cell padding
Header row✅Semi-bold text, light background
Column alignment✅Left / Center / Right from :--- syntax
Grid borders✅Full horizontal + vertical border grid
Multi-line cells✅Row height adapts to tallest cell

Images​

FeatureStatusNotes
Image placeholder✅Rounded rect with alt text label (🖼 prefix)
Image loading❌No actual image fetch/display; placeholder only

Known Limitations​

FeatureStatusEffortNotes
LaTeX math rendering❌HighRequires TeX math layout engine (e.g. KaTeX/MathJax binding or OpenType MATH table consumer). Current fallback shows raw LaTeX source in monospace italic.
Syntax highlighting❌MediumCode block language tag is parsed but ignored. Would need a tokenizer (e.g. syntect or tree-sitter) to map tokens to colored text styles.
Inline HTML (<sup>, etc)❌Mediumpulldown-cmark emits Event::Html for inline HTML. Would need mini HTML parser for supported tags.
<details><summary>❌HighRequires interactive expand/collapse state.
Dark theme❌LowTheme colors are hardcoded light. fixtures/css/github-markdown-dark.css exists for reference.
Footnotes❌MediumParser flag exists (ENABLE_FOOTNOTES) but events not handled.
Nested blockquotes❌LowOnly one level of blockquote indentation rendered.
Image loading❌MediumRequires async fetch + resource registration into the renderer.
Picture caching❌LowCurrently re-renders every frame. Should cache keyed on (markdown hash, width).