Skip to content

Latest commit

 

History

History
143 lines (110 loc) · 2.45 KB

sample.md

File metadata and controls

143 lines (110 loc) · 2.45 KB
title mdview sample
author ivapo
date 2026-08-01
tags
markdown
tui
rendering
draft false

mdview sample

A minimal terminal markdown reader with a hand-rolled renderer.

Inline styling

Plain text, bold, italic, bold italic, strikethrough, and inline code all work. Links look like ratatui and render colored + underlined.

A subheading

Sub-subheadings use color only — no underbar.

Fourth level

Fifth
Sixth

Code blocks

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 a
name: 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: true
plain text with no language tag — still gets the dark background.

Lists

Unordered:

  • first
  • second with emphasis
    • nested
    • also nested
  • third

Ordered:

  1. one
  2. two
  3. three

Task list:

  • write renderer
  • handle code blocks
  • world peace

Blockquote

A short blockquote. The left bar should be dim gray and the text should flow naturally inside the quoted region.

Table

Feature Status Notes
Headings ok h1/h2 with underbar
Code blocks ok syntect-highlighted
Tables ok box-drawing chars
Footnotes basic shown as [^name]

Diagrams

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]
Loading
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
Loading
classDiagram
    class ImageRef {
        +Option~String~ dest
        +Option~Art~ art
    }
    class Art {
        +cells
        +pixels
    }
    ImageRef --> Art : painted over
Loading

Horizontal rule


That's it.