marked-terminal-renderer
v2.2.0
Published
marked terminal renderer
Downloads
60
Maintainers
Readme
marked-terminal-renderer
Modern, full featured terminal renderer extension for marked.
Use it as an extension or use the built in catmd CLI tool to render Markdown
files directly in your terminal. See the usage section for more details.
Most Markdown syntax is supported and rendered with supported terminal (tested on iTerm2):
Typography
- 🌼 Text wrapping and alignment
- 🌼 Headings (H1 to H6)
- 🌼 Bold, Italic, Strikethrough
- 🌼 Clickable Links
- 🌼 Emojis
- 🌼 Inline code highlighted
Block elements
- 🌼 Horizontal rules
- 🌼 Lists (ordered, unordered, nested, task lists)
- 🌼 Blockquotes with nesting
- 🌼 Code blocks with syntax highlighting
- 🌼 Tables
Images
- 🌼 Local and remote (HTTP/S) images rendered directly in terminal
Colorful themes
- 🌼 Light and Dark themes included, easily customizable
Example output rendered in iTerm2

Usage
Installation
Local installation for using it an extension with marked:
npm i marked-terminal-rendererOr use globally to get access to the catmd CLI tool:
npm i -g marked-terminal-rendererBasic usage example, note the use of await since the renderer is asynchronous:
import { marked } from "marked";
import { createTerminalRenderer, darkTheme } from "marked-terminal-renderer";
marked.use(createTerminalRenderer(darkTheme()));
console.log(
await marked.parse(
"# Hello World\nThis is **bold text** and this is a [link](https://example.com). :smile:",
),
);TODOs
- [ ] complete documentation
- [ ] should support different highlight based on themes (dark/light)
- [ ] support auto numbered nested lists (1., 1.1., 1.1.1., etc)
- [x] fix any wrapping issues with nested elements (like lists inside blockquotes)
3rd Party Libraries
Shout out to the following libraries that make this renderer possible ❤️:
| Feature | Library | |---------|------------------------------------------------------------------| | Tables | cli-table3 | | Colors | chalk | | Images | terminal-image | | Links | terminal-link | | Emojis | node-emoji |
