A textual markdown viewer CLI
Project description
A modern, feature-rich terminal-based Markdown viewer with pipeline support, built with Textual.
Table of Contents
- Features
- Installation
- Usage
- Examples
- Supported Markdown Features
- Documentation
- Development
- Contributing
- Troubleshooting
- Roadmap
- License
Features
- ๐ Render Markdown files directly in your terminal
- ๐ Pipeline support - pipe markdown content directly to txmd
- ๐๏ธ Dynamic Table of Contents - Navigate long documents with hierarchical TOC
- ๐จ Syntax highlighting for code blocks
- ๐ Table support
- ๐ผ๏ธ Beautiful TUI interface powered by Textual
- โจ๏ธ Vim-style navigation (j/k for scrolling)
- ๐ Fast and lightweight
Installation
You can install txmd using pip:
pip install txmd
Or using Poetry:
poetry add txmd
Usage
Basic Usage
View a Markdown file:
txmd README.md
Pipeline Usage
Pipe content to txmd:
echo "# Hello World" | txmd
cat document.md | txmd
curl https://raw.githubusercontent.com/user/repo/main/README.md | txmd
Table of Contents
For documents with headers, txmd provides a dynamic Table of Contents sidebar:
Toggle TOC:
t- Show/hide the Table of Contents panel
Using the TOC:
- The TOC automatically parses all headers (# through ######) in your document
- Headers are displayed in a hierarchical tree structure
- Navigate with arrow keys (
โ/โ) when TOC is focused - Press
Enterto expand/collapse sections with subsections - Press
Spaceto jump to the selected section (positions it at top of screen) - Click a header to jump directly to that section
- Leaf sections (no subsections) have no expand icon for cleaner display
- Hidden by default to maximize reading space
The TOC is especially useful for:
- Long documentation files with many sections
- README files with multiple chapters
- Technical documentation with nested topics
- Any structured markdown content
Navigation
Inside the viewer, you can navigate using vim-style keys or traditional navigation keys:
Basic Scrolling:
jorโ- Scroll down one linekorโ- Scroll up one line
Page Scrolling:
SpaceorPage Down- Scroll down one pageborPage Up- Scroll up one page
Jump to Position:
Home- Jump to the top of the documentEnd- Jump to the bottom of the document
Exit:
qorCtrl+C- Quit the viewer
Keybindings Reference
Complete list of all keybindings:
| Key(s) | Action | Description |
|---|---|---|
j, โ |
Scroll Down | Move down one line |
k, โ |
Scroll Up | Move up one line |
Space, Page Down |
Page Down | Scroll down by viewport height |
b, Page Up |
Page Up | Scroll up by viewport height |
Home |
Jump to Top | Scroll to the beginning of the document |
End |
Jump to Bottom | Scroll to the end of the document |
t |
Toggle TOC | Show/hide Table of Contents sidebar |
q, Ctrl+C |
Quit | Exit the application |
Note: All scrolling operations happen instantly without animation for a responsive feel.
Examples
txmd includes a collection of example markdown files demonstrating various features:
# View basic markdown features
txmd examples/basic.md
# See syntax highlighting for various languages
txmd examples/code-blocks.md
# Explore table formatting
txmd examples/tables.md
# Check out advanced features
txmd examples/advanced.md
See the examples directory for more information and sample files.
Supported Markdown Features
txmd supports all standard Markdown elements through Textual's Markdown widget:
| Feature | Support | Notes |
|---|---|---|
| Headers | โ Full | All levels (H1-H6) |
| Text Formatting | โ Full | Bold, italic, strikethrough |
| Lists | โ Full | Ordered, unordered, nested |
| Code Blocks | โ Full | Syntax highlighting for 100+ languages |
| Inline Code | โ Full | Monospace formatting |
| Tables | โ Full | With column alignment |
| Blockquotes | โ Full | Including nested quotes |
| Horizontal Rules | โ Full | Visual separators |
| Links | โ Full | Displayed with formatting |
| Images | โ ๏ธ Partial | Text representation in terminal |
Code Syntax Highlighting
Syntax highlighting is supported for many languages including:
- Python, JavaScript, TypeScript, Rust, Go
- Java, C, C++, C#, Ruby, PHP
- Bash, Shell, PowerShell
- HTML, CSS, SCSS, JSON, YAML, TOML, XML
- SQL, Markdown, and many more
Pipeline Integration
txmd is designed to work seamlessly in Unix pipelines. This means you can:
# Preview markdown before committing
git show HEAD:README.md | txmd
# View remote markdown files
curl -s https://raw.githubusercontent.com/user/repo/main/README.md | txmd
# View markdown from any command output
echo "# Dynamic Content\n\nGenerated at $(date)" | txmd
# Process and view markdown
grep -A 10 "## Section" document.md | txmd
How it works: txmd detects piped input, reads the content, and then restores terminal control by reopening /dev/tty. This allows the TUI to function normally even when receiving piped input.
Platform Note: Full pipeline support works on Linux and macOS. On Windows, use WSL or Windows Terminal for best results.
Documentation
Comprehensive documentation is available:
- CONTRIBUTING.md - Detailed contribution guidelines, development setup, coding standards, and PR process
- ARCHITECTURE.md - Technical architecture, design decisions, and component details
- TROUBLESHOOTING.md - Solutions for common issues and debugging help
- CLAUDE.md - AI assistant context and project overview
- examples/ - Sample markdown files demonstrating features
Development
Quick Start
-
Clone the repository:
git clone https://github.com/guglielmo/txmd cd txmd
-
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -
-
Install dependencies:
poetry install -
Run from source:
poetry run txmd README.md
-
Run tests:
poetry run pytest
Code Quality
# Format code
poetry run black txmd/
# Sort imports
poetry run isort txmd/
# Lint code
poetry run flake8 txmd/
# Run all checks
poetry run black txmd/ && poetry run isort txmd/ && poetry run flake8 txmd/ && poetry run pytest
Project Structure
txmd/
โโโ txmd/
โ โโโ __init__.py # Package initialization
โ โโโ cli.py # Main application (CLI + TUI)
โ โโโ toc.py # Table of Contents module
โโโ tests/
โ โโโ __init__.py
โ โโโ test_cli.py # CLI test suite
โ โโโ test_toc.py # TOC test suite
โโโ examples/ # Example markdown files
โ โโโ basic.md
โ โโโ code-blocks.md
โ โโโ tables.md
โ โโโ advanced.md
โ โโโ README.md
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ ARCHITECTURE.md # Technical documentation
โโโ TROUBLESHOOTING.md # Common issues and solutions
โโโ CLAUDE.md # AI assistant context
โโโ pyproject.toml # Poetry configuration
โโโ README.md # This file
For detailed development information, see CONTRIBUTING.md and ARCHITECTURE.md.
Contributing
Contributions are welcome and appreciated! We'd love your help making txmd better.
Quick Contribution Guide
- Fork and clone the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run quality checks:
poetry run black txmd/ poetry run isort txmd/ poetry run flake8 txmd/ poetry run pytest
- Commit your changes:
git commit -m 'Add amazing feature' - Push to your fork:
git push origin feature/amazing-feature - Open a Pull Request
What to Contribute
- ๐ Bug fixes - Help us squash bugs
- โจ New features - Add capabilities from the roadmap
- ๐ Documentation - Improve or add documentation
- โ Tests - Increase test coverage
- ๐จ Examples - Create new example markdown files
Before Contributing
Please read our comprehensive CONTRIBUTING.md guide which covers:
- Development setup and workflow
- Coding standards and style guide
- Testing guidelines
- PR process and review guidelines
- Project architecture and structure
Getting Help
- Check existing issues
- Read the TROUBLESHOOTING.md guide
- Open a new issue for bugs or feature requests
- Join discussions on GitHub
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Textual
- Markdown parsing by Python-Markdown
- Command-line interface by Typer
Troubleshooting
Having issues? Check our TROUBLESHOOTING.md guide for solutions to common problems:
- Installation issues
- Pipeline/stdin problems
- Display and rendering issues
- Platform-specific issues (Windows, macOS, Linux)
- Performance problems
Quick Fixes
Command not found after install:
# Try running with python -m
python -m txmd README.md
# Or ensure ~/.local/bin is in PATH
export PATH="$HOME/.local/bin:$PATH"
No colors/syntax highlighting:
# Check terminal type
echo $TERM # Should be something like xterm-256color
# Set if needed
export TERM=xterm-256color
Pipeline not working on Windows:
# Use WSL for full pipeline support
wsl -e txmd README.md
For more help, see the full troubleshooting guide.
FAQ
Q: Why use txmd instead of other markdown viewers? A: txmd is designed to be lightweight, fast, and integrate seamlessly with Unix pipelines while providing a beautiful TUI interface. It's perfect for developers who live in the terminal.
Q: Does txmd support custom themes? A: Not yet, but it's on our roadmap! Custom theme support is planned for v0.2.0 or later.
Q: Can I use txmd to preview markdown before committing to git?
A: Absolutely! git show HEAD:README.md | txmd or git diff main...HEAD | txmd
Q: Does txmd work on Windows? A: Yes, but for best results use Windows Terminal or WSL. Pipeline support works best on Linux/macOS or WSL.
Q: Can I view multiple files at once? A: Not yet, but multi-file support with tabs is on the roadmap!
Q: How do I report a bug or request a feature? A: Open an issue on GitHub with details about the bug or feature request.
Roadmap
v0.4.0 - Table of Contents (Released)
Completed:
- Table of Contents - Dynamic TOC with hierarchical navigation
- Hierarchical tree view of document headers
- Toggle with 't' key
- Navigate with arrow keys, expand/collapse with Enter, jump with Space
- Filters headers in code blocks
- Comprehensive Testing - 84% test coverage with UI interaction tests
v0.5.0 - Enhanced Features (Planned)
In Development:
- Multi-file support - View multiple markdown files with tab navigation
- Search functionality - Find text within documents with incremental search
- Bookmark support - Mark and jump to important sections
- Custom themes - Support for custom color schemes and styling
Future Versions
Additional features planned for future releases:
- Configuration file - User preferences and custom keybindings
- GitHub Flavored Markdown - Extended markdown syntax support
- Image preview - Terminal graphics protocol support (Kitty, iTerm2)
- Export functionality - Convert to HTML, PDF
- Watch mode - Auto-reload on file changes
- Split view - View two documents side by side
See the GitHub issues and project milestones for more details.
Support
Getting Help
- ๐ Documentation: Check the docs section above
- ๐ Bug Reports: Open an issue with details
- ๐ก Feature Requests: Request features through GitHub issues
- ๐ฌ Discussions: Join GitHub Discussions for questions and ideas
- ๐ง Troubleshooting: See TROUBLESHOOTING.md
Project Links
- Repository: https://github.com/guglielmo/txmd
- Issue Tracker: https://github.com/guglielmo/txmd/issues
- PyPI Package: https://pypi.org/project/txmd/
- Changelog: See GitHub Releases
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file txmd-0.4.0.tar.gz.
File metadata
- Download URL: txmd-0.4.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccbb661ed99eae40d7851862a11067483a248a7efa583b3d33693276305e41c0
|
|
| MD5 |
0c89bc36212e622625f1d50a6ff5a264
|
|
| BLAKE2b-256 |
c5e5b36ef015f9801aa5c40c23edbe60fa4007cd69c55715178dd1cbd55467c2
|
Provenance
The following attestation bundles were made for txmd-0.4.0.tar.gz:
Publisher:
publish.yml on guglielmo/txmd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txmd-0.4.0.tar.gz -
Subject digest:
ccbb661ed99eae40d7851862a11067483a248a7efa583b3d33693276305e41c0 - Sigstore transparency entry: 623319186
- Sigstore integration time:
-
Permalink:
guglielmo/txmd@5ab06d91f82bb60854cfa9f85ce1a9afa4b4cb05 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/guglielmo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ab06d91f82bb60854cfa9f85ce1a9afa4b4cb05 -
Trigger Event:
release
-
Statement type:
File details
Details for the file txmd-0.4.0-py3-none-any.whl.
File metadata
- Download URL: txmd-0.4.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71ae0b5d22217c90ecfa9cbb43a9e1bb9d61066deeeffb4315b438807e1447a
|
|
| MD5 |
9509ad94ff9503149c43e3e92c83f047
|
|
| BLAKE2b-256 |
9410bc2b2a5c561011ce170068a201ba34a1a040e8feca031c6e816e1ce9eeb9
|
Provenance
The following attestation bundles were made for txmd-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on guglielmo/txmd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txmd-0.4.0-py3-none-any.whl -
Subject digest:
e71ae0b5d22217c90ecfa9cbb43a9e1bb9d61066deeeffb4315b438807e1447a - Sigstore transparency entry: 623319197
- Sigstore integration time:
-
Permalink:
guglielmo/txmd@5ab06d91f82bb60854cfa9f85ce1a9afa4b4cb05 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/guglielmo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ab06d91f82bb60854cfa9f85ce1a9afa4b4cb05 -
Trigger Event:
release
-
Statement type: