logs.gokuls.in

2 pull requests merged across 1 repo

bahdotsh/mdterm

— images fall back to half-blocks inside tmux+Ghostty because standard Kitty placement commands don't work through tmux.

  • Adds ImageProtocol::KittyUnicode variant that uses the Kitty Unicode placeholder method: image data is uploaded via DCS passthrough, and placement uses U+10EEEE placeholder characters with combining diacritics (row/col) and foreground color (image ID)
  • Auto-detects tmux via TMUX env var, then probes for Kitty-capable outer terminal (TERM_PROGRAM, TERM, KITTY_WINDOW_ID, KONSOLE_VERSION)
  • Can be forced with MDTERM_IMAGE_PROTOCOL=kitty-unicode
  • Keeps existing direct Kitty path unchanged (more efficient outside tmux)

Note: Requires set -g allow-passthrough on in tmux config for DCS passthrough to work.

Test plan

  • cargo check / cargo clippy — no warnings
  • cargo test — all 127 tests pass
  • Manual test in tmux+Ghostty: MDTERM_IMAGE_PROTOCOL=kitty-unicode cargo run -- <file-with-images.md>
  • Manual test outside tmux: verify auto-detection still picks Kitty for Ghostty/Kitty
  • Verify MDTERM_IMAGE_PROTOCOL=kitty still works as before (direct path unchanged)
  • Adds a new json.rs module that parses JSON files and renders them as structured tree views with Unicode box-drawing guides, color-coded types, and automatic table detection for arrays of homogeneous objects
  • All existing viewer features (search, TOC, link picker, keyboard nav, auto-reload, multi-file switching, HTML export) work automatically for JSON files — no viewer logic changes needed beyond a render dispatch
  • Adds 7 new JSON-specific theme colors (json_key, json_string, json_number, json_bool, json_null, json_bracket, json_path) to both dark and light themes

Test plan

  • cargo run -- test.json — verify tree view renders with colored types, headings, and table for dependencies/authors
  • Press o — TOC shows top-level JSON keys as sections
  • Press / and search — highlights matches in JSON content
  • Press f — link picker finds URLs from JSON string values
  • cargo run -- test.json README.md and Tab — multi-file switching between JSON and markdown
  • cargo run -- test.json --export html — HTML export works
  • cat test.json | cargo run -- --no-color — piped output works (renders as markdown fallback for stdin)
  • cargo test — all 123 existing tests pass
  • cargo clippy — clean