MarkRender
Professional Terminal Markdown Renderer for Streaming LLM Responses
MarkRender is a Python library that renders markdown in terminals, designed for streaming LLM responses. It provides syntax highlighting, multiple color themes, and supports markdown features without flickering.
Features
- Streaming Support - Designed for chunk-by-chunk LLM response rendering
- 7 Themes - github-dark, monokai, dracula, nord, one-dark, solarized-dark, solarized-light
- Syntax Highlighting - Powered by Pygments with 500+ languages
- Dim Mode - Render content in dimmed/reduced colors for "thinking" sections
- Theme Preview - Preview all themes with sample content via CLI
- Line Numbers - Optional line numbers in code blocks
- Tables - Table rendering with borders and overflow truncation
- Checkboxes - Task list support
- Emoji Support - Converts
:emoji_name:to actual emojis - Links - Styled hyperlinks with URLs
- Full Markdown - Headings, lists, blockquotes, horizontal rules, alerts, and more
- Force Color - Force color output even in non-tty terminals
- Customizable - Custom colors, backgrounds, and formatting options
- Python 3.7+ - Compatible with Python 3.7 and above
Installation
pip install git+https://github.com/Praneeth-Gandodi/markrender.git
Or install from source:
git clone https://github.com/Praneeth-Gandodi/markrender.git
cd markrender
pip install -e .
Quick Start
from markrender import MarkdownRenderer
# Create renderer with default theme
renderer = MarkdownRenderer()
# Render markdown content
markdown_text = """
# Hello World
This is **bold** and this is *italic*.
```python
def hello():
print("Hello from MarkRender!")
```
## Features
- Item 1
- Item 2
- [x] Completed task
- [ ] Pending task
"""
renderer.render(markdown_text)
renderer.finalize()
Streaming LLM Responses
Perfect for rendering streaming responses from LLM APIs:
from markrender import MarkdownRenderer
from openai import OpenAI
client = OpenAI()
renderer = MarkdownRenderer(theme='github-dark')
stream = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Explain quantum computing"}],
stream=True
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content:
renderer.render(content)
renderer.finalize()
Dim Mode
Use dim mode for "thinking" sections or less prominent content:
from markrender import MarkdownRenderer
renderer = MarkdownRenderer()
# Normal rendering
renderer.render("This is **normal** content")
# Dim/reduced color rendering
renderer.render("This content is dimmed and less prominent", dim_mode=True)
Theme Preview
Preview all available themes from the CLI:
markrender --preview-themes
Themes
MarkRender includes 7 professional color themes:
themes = [
'github-dark', # GitHub's dark theme (default)
'monokai', # Popular Monokai theme
'dracula', # Dracula theme
'nord', # Nord color palette
'one-dark', # Atom One Dark
'solarized-dark', # Solarized Dark
'solarized-light' # Solarized Light
]
renderer = MarkdownRenderer(theme='dracula')
List available themes:
markrender --list-themes
Configuration
Python API
from markrender import MarkdownRenderer
from markrender.colors import rgb
renderer = MarkdownRenderer(
theme='monokai', # Color theme
code_background=False, # Show background in code blocks
line_numbers=True, # Show line numbers in code
inline_code_color=rgb(255, 100, 200), # Custom inline code color
width=100, # Terminal width (auto-detect by default)
force_color=False, # Force color output
stream_code=True # Stream code lines as they arrive
)
Parameters
- theme (str): Color theme name (default:
'github-dark') - code_background (bool): Show background in code blocks (default:
False) - line_numbers (bool): Show line numbers in code blocks (default:
True) - inline_code_color (str): Custom ANSI color code for inline code (default: theme default)
- width (int): Terminal width in characters (default: auto-detect)
- force_color (bool): Force color output even if terminal does not support it (default:
False) - stream_code (bool): Render code lines as they arrive instead of buffering (default:
True) - output (file): Output stream (default:
sys.stdout)
CLI Usage
markrender README.md
markrender --theme dracula file.md
cat file.md | markrender
markrender --preview-themes
markrender --list-themes
markrender --no-line-numbers --code-background file.md
markrender --width 80 --force-color file.md
Config File
MarkRender supports TOML configuration files. Place a .markrender.toml in your current directory or ~/.markrender/config.toml:
[theme]
name = "github-dark"
[rendering]
code_background = false
line_numbers = true
[output]
# width = 80
force_color = false
[features]
stream_code = true
Supported Markdown Features
Headings
# H1 Heading
## H2 Heading
### H3 Heading
#### H4 Heading
##### H5 Heading
###### H6 Heading
Code Blocks
```python
def example():
return "Syntax highlighted!"
```
Inline Code
Use `inline code` for short snippets.
Tables
| Feature | Supported |
|---------|-----------|
| Tables | Yes |
| Borders | Yes |
Lists
- Unordered item 1
- Unordered item 2
- Nested item
1. Ordered item 1
2. Ordered item 2
Checkboxes
- [x] Completed task
- [ ] Pending task
Blockquotes
> This is a blockquote
> It can span multiple lines
Alerts (GitHub-flavored)
> [!NOTE]
> Useful information users should know
> [!TIP]
> Helpful advice
> [!IMPORTANT]
> Key information
> [!WARNING]
> Urgent information
> [!CAUTION]
> Potential negative consequences
Links
[Link text](https://example.com)
Text Formatting
**Bold text**
*Italic text*
***Bold and italic***
~~Strikethrough~~
Emojis
Hello :wave: Let's :rocket: go!
Horizontal Rules
---
Use Cases
- AI Chat Applications - Render LLM responses in CLI tools
- Documentation Viewers - Display markdown documentation in terminal
- Code Review Tools - Show code diffs and comments
- Note-Taking Apps - Terminal-based markdown note viewers
- Log Viewers - Render structured logs with markdown
Development
Setup Development Environment
git clone https://github.com/Praneeth-Gandodi/markrender.git
cd markrender
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"
Run Tests
pytest tests/ -v
pytest tests/ --cov=markrender --cov-report=html --cov-report=term
Run Examples
python examples/basic_usage.py
python examples/streaming_demo.py
python examples/theme_showcase.py
Releasing
The package version is derived from git tags by setuptools_scm, so there is
no version number to edit by hand.
- Open Actions → Publish → Run workflow.
- Choose
auto(recommended) or an explicitpatch,minor, ormajorbump. - The workflow runs the tests, creates the next
vX.Y.Ztag, builds the sdist and wheel, publishes to PyPI, and creates a GitHub release.
With auto, commit messages since the last tag decide the bump:
feat!:or aBREAKING CHANGE:footer → majorfeat:→ minor- everything else → patch
Publishing uses PyPI Trusted Publishing (OIDC), so no API token is stored in the repository. Configure it once:
- PyPI: project
markrender→ Publishing → add a trusted publisher with ownerPraneeth-Gandodi, repositorymarkrender, workflowpublish.yml, environmentpypi. - GitHub: Settings → Environments → create an environment named
pypi.
The repository default workflow permission can stay read-only; the workflow
requests contents: write only for the jobs that create the tag and release.
You can also publish an existing tag directly:
git tag v1.1.0
git push origin v1.1.0
To publish automatically after every merge to main, uncomment the branches: [main] trigger in .github/workflows/publish.yml.
License
MIT License - see LICENSE file for details.
Metadata
Release files for markrender 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| markrender-1.1.0.tar.gz | 48.8 kB | With provenance | Details for markrender-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markrender-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for markrender-1.1.0-py3-none-any.whl |
Total release size: 71.9 kB
Release files / markrender-1.1.0.tar.gz
| Download URL | markrender-1.1.0.tar.gz |
|---|---|
| Size | 48.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95b7cd587aeed7986942918ff35e05e4b8075f8a94dd78c05186912d978e70a3
|
|
BLAKE2b-256 checksum How to use checksums |
6f9d640f52d9177e563b31d4a5773249e3fa322ba4811eef6d6091cd2683763e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / markrender-1.1.0-py3-none-any.whl
| Download URL | markrender-1.1.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab6437f62bbc58bf36c5d6872ef8a54d54784c6f466aa22e2282e1705efb80b5
|
|
BLAKE2b-256 checksum How to use checksums |
cbf5646135fead6d299155a2e2cd8087c1d71db4640395ee72befd1ac5c7e1d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for markrender 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for markrender-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.