MarkRender
Professional Terminal Markdown Renderer for Streaming LLM Responses
MarkRender renders markdown in the terminal. It is built for streaming output, so you can hand it a complete string or feed it chunks from an LLM as they arrive. Syntax highlighting, themes, tables, and the rest work the same either way, without reprinting content that is already on screen.
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 "thinking" content in a single muted gray
- 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
MarkRender is on PyPI:
pip install markrender
That installs the library and the markrender command. Check that it worked:
markrender --version
Upgrade an existing install with:
pip install --upgrade markrender
If you want to work on MarkRender itself, clone the repo and install it in editable mode instead:
git clone https://github.com/Praneeth-Gandodi/markrender.git
cd markrender
pip install -e ".[dev]"
Command Line
Render a file:
markrender README.md
Read markdown from stdin:
cat notes.md | markrender
On PowerShell:
Get-Content notes.md -Raw | markrender
Pick a theme:
markrender --theme dracula notes.md
Adjust code blocks:
markrender --no-line-numbers notes.md
markrender --code-background notes.md
markrender --no-stream-code notes.md
Set a fixed width when the terminal reports the wrong size, or when the output goes somewhere else:
markrender --width 80 notes.md
Force color when piping into another program, a log file, or CI:
markrender --force-color notes.md | less -R
List the theme names:
markrender --list-themes
Preview every theme with sample content:
markrender --preview-themes
Running markrender with no file and nothing piped in prints an error and exits.
Options
| Option | Description |
|---|---|
--theme NAME |
Color theme (default: github-dark) |
--no-line-numbers |
Hide line numbers in code blocks |
--code-background |
Show a background behind code blocks |
--width N |
Wrap at a fixed width instead of the terminal width |
--no-stream-code |
Render code blocks in one pass instead of line by line |
--force-color |
Emit colors even when the output is not a terminal |
--list-themes |
Print available themes and exit |
--preview-themes |
Render sample markdown in every theme and exit |
-v, --version |
Print the version and exit |
CLI flags override values from a config file. See Configuration.
Python API
Render a string
from markrender import MarkdownRenderer
renderer = MarkdownRenderer()
markdown = """
# Hello
Some **bold** text, some *italic* text, and `inline code`.
```python
def hello():
print("Hello from MarkRender!")
```
- A list item
- [x] A finished task
- [ ] A pending task
"""
renderer.render(markdown)
renderer.finalize()
render() writes output as it parses, and finalize() flushes whatever is still buffered. For a string you already have, call them one after the other.
Streaming LLM responses
from markrender import MarkdownRenderer
from openai import OpenAI
client = OpenAI()
renderer = MarkdownRenderer(theme="github-dark")
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Explain quantum computing"}],
stream=True,
)
for chunk in stream:
text = chunk.choices[0].delta.content
if text:
renderer.render(text)
renderer.finalize()
The renderer keeps partial lines and open blocks in an internal buffer, so chunks can split anywhere: mid-word, mid-table, or in the middle of a code fence. Feed every chunk and call finalize() once when the stream ends.
Dim mode
render() takes a dim_mode argument, which draws that chunk as plain muted gray. Formatting colors, bold, and syntax highlighting are dropped so the whole block reads like thinking text instead of competing with the answer:
renderer.render("Let me think about this...", dim_mode=True)
renderer.render("Here is the answer.", dim_mode=False)
Dim mode applies per call, so you can turn it on and off while streaming.
Custom output
By default output goes to stdout. Pass any text stream with output:
from markrender import MarkdownRenderer
with open("rendered.txt", "w", encoding="utf-8") as log:
renderer = MarkdownRenderer(output=log, force_color=True)
renderer.render("# Saved to a file\n")
renderer.finalize()
Color detection still looks at stdout, so set force_color=True if you want ANSI colors in the file.
Constructor options
| Parameter | Default | Description |
|---|---|---|
theme |
"github-dark" |
Theme name |
code_background |
False |
Draw a background behind code blocks |
line_numbers |
True |
Show line numbers in code blocks |
inline_code_color |
theme default | ANSI color code for inline code |
width |
auto-detect | Wrap width in characters |
force_color |
False |
Emit color even when the output is not a TTY |
stream_code |
True |
Render code lines as they arrive |
output |
sys.stdout |
Stream to write to |
use_config |
True |
Load a config file if one is found |
config |
None |
Pass a RendererConfig directly |
Custom inline code color uses the rgb helper:
from markrender import MarkdownRenderer
from markrender.colors import rgb
renderer = MarkdownRenderer(
theme="monokai",
inline_code_color=rgb(255, 100, 200),
width=100,
)
Configuration
MarkRender reads a TOML config file if one exists. It checks these locations in order and uses the first match:
.markrender.tomlin the current directory~/.markrender/config.toml~/.config/markrender/config.toml
Example .markrender.toml:
[theme]
name = "dracula"
[rendering]
code_background = true
line_numbers = false
[output]
width = 100
force_color = false
[features]
stream_code = false
Values are applied in this order, from highest to lowest priority:
- Arguments passed to
MarkdownRenderer(...) - The config file
- Built-in defaults
Only non-None arguments override the config, so MarkdownRenderer() picks up your file settings. Pass use_config=False to ignore config files entirely.
Themes
| Theme | Notes |
|---|---|
github-dark |
GitHub's dark theme (default) |
monokai |
Classic Monokai palette |
dracula |
Dracula palette |
nord |
Nord palette |
one-dark |
Atom One Dark |
solarized-dark |
Solarized Dark |
solarized-light |
Solarized Light |
renderer = MarkdownRenderer(theme="dracula")
See the names from the CLI with markrender --list-themes, or render a sample in each theme with markrender --preview-themes.
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
Changelog
Release notes come from conventional commit messages, so the history stays in one place. See CHANGELOG.md for what changed in each version.
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. - Release notes are generated from the commits since the last tag, and the
same entry is added to CHANGELOG.md on
main.
With auto, commit messages since the last tag decide the bump:
feat!:or aBREAKING CHANGE:footer → majorfeat:→ minorfix:,perf:,refactor:, orrevert:→ patchdocs:,test:,chore:,ci:,build:, andstyle:don't trigger a release on their own
Write commit subjects in the type(scope): summary form so the changelog and
version bump stay accurate.
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.2.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.2.0.tar.gz | 55.5 kB | With provenance | Details for markrender-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markrender-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for markrender-1.2.0-py3-none-any.whl |
Total release size: 80.6 kB
Release files / markrender-1.2.0.tar.gz
| Download URL | markrender-1.2.0.tar.gz |
|---|---|
| Size | 55.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b878b90dcd04b6a99760330f607d62f390b154cabd40c82e1e42dba8086cb841
|
|
BLAKE2b-256 checksum How to use checksums |
d9a0ea8455a51ea0f23a86a891f7ccbecca689dc900312ff023a4eb161aa2b5b
|
| 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.2.0-py3-none-any.whl
| Download URL | markrender-1.2.0-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9f97945d331e1b2434e548b5cb9a9ba65ba78b603710424b19728a199918669
|
|
BLAKE2b-256 checksum How to use checksums |
b59dbf943091394c85708d9d47892e4bcb1e13ed26b79264f8d1a3b8e00f1467
|
| 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.2.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.2.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.