mkd
A terminal Markdown viewer. Renders Markdown with ANSI escape codes and the Kitty graphics/text sizing protocol.
Installation
gem install mkdOr add to your Gemfile:
bundle add mkdUsage
mkd README.mdOr pipe from stdin:
cat README.md | mkdFrom Ruby:
require 'mkd'
print Mkd.render(markdown_string)Features
Inline formatting
-
Bold, italic, bold italic,
strikethrough,inline code - Hyperlinks via OSC 8 terminal sequences
- :emoji: shortcodes (GitHub-style, powered by gemoji)
Headings
- H1 and H2 use scaled text via the text sizing protocol (OSC 66) when the terminal supports it, falling back to bold text otherwise
- Terminal support is auto-detected at runtime by probing cursor position
- H3 through H6 use bold, underline, and dim ANSI styles
Code blocks
Syntax-highlighted fenced code blocks via Rouge:
puts "hello, world"Lists
- Unordered lists with bullet characters
- Ordered (numbered) lists
- Nested lists with increasing indentation
- GFM task lists:
- unchecked
- checked
Tables
Rendered with box-drawing characters:
| Feature | Status |
|---|---|
| Tables | ✅ |
| Alignment | ✅ |
Other
- Block quotes with vertical bar
- Horizontal rules
- Images displayed inline via the Kitty graphics protocol (PNG, SVG)
- Clickable image links
Screenshot
Requirements
- A terminal with ANSI escape code support
- Kitty (or compatible terminal, like Echoes) for image display and scaled headings (auto-detected; works without these in degraded mode)
License
The gem is available as open source under the terms of the MIT License.
