Repository navigation
Markdown Rendering
Blinc has a built-in markdown renderer. It converts CommonMark + GFM markdown to native layout elements.
use blinc::layout::markdown::markdown;
// Render markdown to a Div
let content = markdown(r#"
# Hello World
This is **bold** and *italic* text.
- List item 1
- List item 2
"#);
// Use in your layout
div()
.flex_col()
.child(content)Markdown takes its colors from the current theme. markdown_light is a compact style with smaller
text and tighter spacing:
use blinc::layout::markdown::{markdown, markdown_light, markdown_with_config, MarkdownConfig};
// The default style
let regular = markdown("# Heading");
// Compact: smaller text and tighter spacing
let compact = markdown_light("# Heading");
// Custom configuration
let custom = markdown_with_config("# Custom", MarkdownConfig {
h1_size: 36.0,
body_size: 16.0,
..MarkdownConfig::default()
});| Markdown | Result |
|---|---|
**bold** |
bold text |
*italic* |
italic text |
~~strikethrough~~ |
|
`inline code` |
inline code |
[link](url) |
clickable link |
markdown(r#"
This is **bold**, *italic*, and ~~strikethrough~~ text.
Here's some `inline code` and a [link](https://example.com).
"#)markdown(r#"
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
"#)Unordered lists:
markdown(r#"
- First item
- Second item
- Nested item
- Another nested
- Third item
"#)Ordered lists:
markdown(r#"
1. First step
2. Second step
3. Third step
"#)Task lists (GFM extension):
markdown(r#"
- [x] Completed task
- [ ] Pending task
- [x] Another done
"#)A fenced code block can name a language, but the name is optional:
markdown(r#"
```rust
fn main() {
println!("Hello, Blinc!");
}
```
"#)A code block shows its code with line numbers. The renderer does not highlight syntax.
markdown(r#"
> This is a blockquote.
> It can span multiple lines.
>
> And have multiple paragraphs.
"#)markdown(r#"
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
"#)markdown(r#"
Content above
---
Content below
"#)markdown(r#"


"#)To customize the renderer, use MarkdownConfig:
use blinc::layout::markdown::{markdown_with_config, MarkdownConfig};
use blinc::core::Color;
let config = MarkdownConfig {
// Typography sizes
h1_size: 32.0,
h2_size: 28.0,
h3_size: 24.0,
h4_size: 20.0,
h5_size: 18.0,
h6_size: 16.0,
body_size: 16.0,
code_size: 14.0,
// Colors
text_color: Color::WHITE,
link_color: Color::rgba(0.4, 0.6, 1.0, 1.0),
code_bg: Color::rgba(0.1, 0.1, 0.12, 1.0),
code_text: Color::rgba(0.9, 0.6, 0.3, 1.0),
// Spacing
paragraph_spacing: 16.0,
heading_spacing: 24.0,
// Lists
list_indent: 24.0,
list_item_spacing: 4.0,
..Default::default()
};
let content = markdown_with_config("# Custom Styled", config);// The default: theme colors
let regular = MarkdownConfig::default();
// Theme colors with smaller text and tighter spacing
let compact = MarkdownConfig::light();The examples include a full markdown editor with a live preview. To run it, use this command:
cargo run -p blinc_app_examples --example markdown_demoThe editor shows these features:
- A TextArea to edit the markdown source
- A live preview with
markdown_light() - Stateful reactive updates on each text change
The renderer decodes HTML entities in text automatically:
markdown(r#"
© 2025 — All rights reserved
Temperature: 72°F
Price: €99.99
"#)Common entities include & (&), < (<), > (>), " ("), and (non-breaking space). They also include © (©), ™ (™), and many more.
-
For a compact layout, use
markdown_light(). Both styles follow the light or dark theme. -
For long content, put the markdown in a scroll container. Markdown can produce tall content:
scroll() .h(600.0) .direction(ScrollDirection::Vertical) .child(markdown(long_content))
-
Set the width of the container. Markdown content follows the width of its parent:
div() .w(800.0) .child(markdown(content))
-
Code blocks need height. Make sure that the container is tall enough for them.
-
Images need explicit dimensions. Images will render, but for the best result, put a width constraint on the markdown container.
Getting Started
Migrating
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Run with
cargo run -p blinc_app_examples --features cn --example cn_pickers_demo. - Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. - Gpu Pass Demo
- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- Accessibility
- State Management
- Lists & Conditional Content
- Element Refs
Animation
Components
Component Library (blinc_cn)
- Overview
- Button
- Card
- Icons
- Typography
- Dialog
- Form Components
- Date, Time and Colour Pickers
- Rich Text Editor
- Code Editor
- Navigation
- Feedback
- Layout
- Data Display
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Gestures
- Notched Surfaces
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot reloading
Architecture
Contributing