smart-markdown
Parse and render Markdown to ANSI-styled terminal output with live in-place refresh.
Features
- Full CommonMark — headings, paragraphs, code blocks, blockquotes, lists, tables, horizontal rules
- GFM extensions — tables, task lists, strikethrough, autolinks
- Inline formatting — bold, italic, strikethrough, inline code, links, images
- Unicode heading prefixes —
◆●▼▾▿·per level - Syntax highlighting — optional via
syntax-highlightfeature (7 bundled themes) - Terminal-aware — auto-detects width, wraps text, uses ANSI escape sequences
- Live streaming — in-place re-render for dashboards and pipelines
- Reference links, backslash escapes, indented code blocks, HTML blocks, nested lists
- Extras — highlight (
==text==), sub/superscript, math ($...$), emoji shortcodes (:rocket:), footnotes, definition lists
Quick start
use Markdown;
let mut md = parse;
md.render;
Streaming example
use Markdown;
let mut md = parse;
md.render;
// Update cells and re-render in place
md.set_cell_content;
md.append_to_cell;
md.render;
Run the examples:
Markdown support
Block elements
| Element | Syntax |
|---|---|
| Headings | # through ###### |
| Paragraphs | plain text |
| Fenced code blocks | ```lang / ~~~ |
| Indented code blocks | 4 spaces or tab |
| Blockquotes | > |
| Unordered lists | -, *, + |
| Ordered lists | 1., 2. |
| Nested lists | 4-space indented |
| Task lists | - [ ], - [x] |
| Tables | pipe-delimited |
| Definition lists | term / : definition |
| HTML blocks | <div>, <pre>, etc. |
| Horizontal rules | ---, ***, ___ |
Inline elements
| Element | Syntax |
|---|---|
| Bold | **text** or __text__ |
| Italic | *text* or _text_ |
| Strikethrough | ~~text~~ |
| Inline code | `code` |
| Links | [text](url) |
| Reference links | [text][ref] + [ref]: url |
| Autolinks | <https://url> |
| Images |  |
| Highlight | ==text== |
| Subscript | ~text~ |
| Superscript | ^text^ |
| Math | $...$ |
| Emoji | :smile:, :rocket: |
| Footnotes | [^1] |
| Backslash escapes | \*, \_, etc. |
Options
parse
.theme_mode // Auto, Dark, or Light
.code_theme // Custom syntax theme
.render;
License
Apache-2.0