| title | mdview sample | |||
|---|---|---|---|---|
| author | ivapo | |||
| date | 2026-08-01 | |||
| tags |
|
|||
| draft | false |
A minimal terminal markdown reader with a hand-rolled renderer.
Plain text, bold, italic, bold italic, strikethrough, and
inline code all work. Links look like ratatui
and render colored + underlined.
Sub-subheadings use color only — no underbar.
fn main() {
let greeting = "hello, mdview";
println!("{greeting}");
for i in 0..3 {
println!("count = {i}");
}
}def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return aname: mdview
version: 0.3.0
keys:
- key: "?"
action: show keybindings
- key: tab
action: toggle raw view
frame:
color: darkgray # anchors, quotes, and comments should all be distinct
brand: trueplain text with no language tag — still gets the dark background.
Unordered:
- first
- second with emphasis
- nested
- also nested
- third
Ordered:
- one
- two
- three
Task list:
- write renderer
- handle code blocks
- world peace
A short blockquote. The left bar should be dim gray and the text should flow naturally inside the quoted region.
| Feature | Status | Notes |
|---|---|---|
| Headings | ok | h1/h2 with underbar |
| Code blocks | ok | syntect-highlighted |
| Tables | ok | box-drawing chars |
| Footnotes | basic | shown as [^name] |
Drawn in iTerm2, WezTerm and Rio; listed as code everywhere else.
flowchart TD
open[Open the file] --> kind{Mermaid block?}
kind -->|yes| layout[Lay out with merman]
kind -->|no| md[Render as markdown]
layout --> raster[Rasterise with resvg]
raster --> paint[Paint over the half-blocks]
sequenceDiagram
participant U as You
participant M as mdview
participant T as Terminal
U->>M: press +
M->>M: re-rasterise the cached layout
M->>T: half-block rows
M->>T: inline image
classDiagram
class ImageRef {
+Option~String~ dest
+Option~Art~ art
}
class Art {
+cells
+pixels
}
ImageRef --> Art : painted over
That's it.