A CLI tool to render Markdown files using Python's rich library, providing beautiful terminal output with syntax highlighting, tables, and more.
- Render Markdown files with rich terminal formatting
- Support for tables, code blocks, lists, and other Markdown elements
- Read from files or stdin
- Beautiful syntax highlighting
- Cross-platform compatibility
# Run directly from GitHub (latest version)
uvx --from git+https://github.com/cleemesser/markdown2rich.git markdown2rich README.mduv tool install --from git+https://github.com/cleemesser/markdown2rich.git markdown2rich
markdown2rich README.md
# Or install directly from GitHub
pipx install git+https://github.com/cleemesser/markdown2rich.gitwill update this to pipx install markdown2rich if I decide to upload to pypi
# Render a markdown file
markdown2rich README.md
# Read from stdin
cat README.md | markdown2rich
# Using redirection
markdown2rich < README.md# Show help
markdown2rich --help
# Show version
markdown2rich --version
# Disable forced terminal output (auto-detect terminal capabilities)
markdown2rich --no-force-terminal README.mdecho "# Hello World\n\nThis is **bold** and this is *italic*." | markdown2richmarkdown2rich docs/api.md# Use with curl to render remote markdown
curl -s https://raw.githubusercontent.com/user/repo/main/README.md | markdown2rich
# Use with find to preview multiple files
find . -name "*.md" -exec echo "=== {} ===" \; -exec markdown2rich {} \;This repository includes an Emacs package for seamless Markdown preview integration.
(use-package markdown-preview-with-rich
:straight (:host github :repo "cleemesser/markdown2rich" :files ("markdown-preview-with-rich.el"))
:after markdown-mode
:custom
(markdown-preview-rich-command "markdown2rich")
(markdown-preview-rich-display-action 'pop-to-buffer))(use-package markdown-preview-with-rich
:load-path "/path/to/rich_markdown_preview/"
:after markdown-mode
:custom
(markdown-preview-rich-command "markdown2rich")
(markdown-preview-rich-display-action 'pop-to-buffer))- Download
markdown-preview-with-rich.el - Add to your Emacs load path:
(add-to-list 'load-path "/path/to/rich_markdown_preview/")
(require 'markdown-preview-with-rich)- Command:
M-x markdown-preview-with-rich - Keybinding:
C-c r(in markdown-mode) - Customization:
M-x customize-group RET markdown-preview-rich RET
markdown-preview-rich-command: Command to use. Options include:"markdown2rich"(default - for pip/pipx installations)"uvx -q --from git+https://github.com/cleemesser/markdown2rich.git markdown2rich"(uvx from GitHub)"uvx markdown2rich"(uvx from PyPI)- Custom command string
markdown-preview-rich-buffer-name: Preview buffer namemarkdown-preview-rich-display-action: How to display the preview buffermarkdown-preview-rich-keybinding: Key binding for the preview function
If you have uvx installed, this is the easiest way to get started inside emacs 30+:
(use-package markdown-preview-with-rich
:vc (:url "https://github.com/cleemesser/markdown2rich.git" :rev :newest)
:after markdown-mode
:custom
(markdown-preview-rich-command "uvx -q --from git+https://github.com/cleemesser/markdown2rich.git markdown2rich")
;; (markdown-preview-rich-command "markdown2rich")
(markdown-preview-rich-display-action 'pop-to-buffer))(use-package markdown-preview-with-rich
:straight (:host github :repo "cleemesser/markdown2rich" :files ("markdown-preview-with-rich.el"))
:after markdown-mode
:custom
(markdown-preview-rich-command "uvx -q --from git+https://github.com/cleemesser/markdown2rich.git markdown2rich")
(markdown-preview-rich-display-action 'pop-to-buffer))- Install the Python CLI tool:
pipx install markdown2rich - Install
markdown-modefor Emacs
# Clone the repository
git clone <repository-url>
cd markdown2rich
# Install in development mode
pip install -e .
# Or use pipx for isolated environment
pipx install -e .pip install -e ".[dev]"
pytestblack markdown2rich/
flake8 markdown2rich/
mypy markdown2rich/- Python 3.8+
- rich >= 10.0.0
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.