markrender 1.0.7__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- markrender-1.1.0/.gitignore +74 -0
- {markrender-1.0.7 → markrender-1.1.0}/LICENSE +21 -21
- markrender-1.1.0/MANIFEST.in +2 -0
- markrender-1.1.0/PKG-INFO +405 -0
- markrender-1.1.0/README.md +373 -0
- markrender-1.1.0/check_truecolor.py +30 -0
- markrender-1.1.0/examples/basic_usage.py +76 -0
- markrender-1.1.0/examples/complete_showcase.py +176 -0
- markrender-1.1.0/examples/definition_lists.py +82 -0
- markrender-1.1.0/examples/footnotes.py +83 -0
- markrender-1.1.0/examples/highlights.py +86 -0
- markrender-1.1.0/examples/link_highlighting.py +67 -0
- markrender-1.1.0/examples/mermaid_diagrams.py +91 -0
- markrender-1.1.0/examples/new_features_demo.py +188 -0
- markrender-1.1.0/examples/progress_bars.py +94 -0
- markrender-1.1.0/examples/streaming_demo.py +134 -0
- markrender-1.1.0/examples/theme_showcase.py +60 -0
- markrender-1.1.0/examples/v1_0_7_showcase.py +103 -0
- markrender-1.1.0/markrender/__init__.py +22 -0
- markrender-1.0.7/markrender/cli.py → markrender-1.1.0/markrender/__main__.py +75 -69
- markrender-1.1.0/markrender/_version.py +24 -0
- markrender-1.1.0/markrender/cli.py +11 -0
- markrender-1.1.0/markrender/colors.py +203 -0
- {markrender-1.0.7 → markrender-1.1.0}/markrender/config.py +11 -6
- markrender-1.1.0/markrender/formatters.py +348 -0
- markrender-1.1.0/markrender/parser.py +193 -0
- markrender-1.1.0/markrender/renderer.py +447 -0
- {markrender-1.0.7 → markrender-1.1.0}/markrender/themes.py +65 -70
- markrender-1.1.0/markrender.egg-info/PKG-INFO +405 -0
- markrender-1.1.0/markrender.egg-info/SOURCES.txt +44 -0
- markrender-1.1.0/markrender.egg-info/entry_points.txt +2 -0
- markrender-1.1.0/markrender.egg-info/requires.txt +9 -0
- markrender-1.1.0/markrender.egg-info/scm_file_list.json +43 -0
- {markrender-1.0.7 → markrender-1.1.0}/pyproject.toml +24 -10
- markrender-1.1.0/requirements.txt +3 -0
- {markrender-1.0.7 → markrender-1.1.0}/setup.cfg +4 -4
- markrender-1.1.0/setup.py +2 -0
- markrender-1.1.0/test.md +624 -0
- markrender-1.1.0/tests/test_colors.py +196 -0
- markrender-1.1.0/tests/test_formatters.py +369 -0
- markrender-1.1.0/tests/test_parser.py +311 -0
- markrender-1.1.0/tests/test_regressions.py +307 -0
- markrender-1.1.0/tests/test_renderer.py +622 -0
- markrender-1.1.0/tests/test_versioning.py +119 -0
- markrender-1.0.7/PKG-INFO +0 -568
- markrender-1.0.7/README.md +0 -535
- markrender-1.0.7/markrender/__init__.py +0 -21
- markrender-1.0.7/markrender/colors.py +0 -195
- markrender-1.0.7/markrender/formatters.py +0 -1131
- markrender-1.0.7/markrender/parser.py +0 -921
- markrender-1.0.7/markrender/renderer.py +0 -640
- markrender-1.0.7/markrender.egg-info/PKG-INFO +0 -568
- markrender-1.0.7/markrender.egg-info/SOURCES.txt +0 -26
- markrender-1.0.7/markrender.egg-info/entry_points.txt +0 -2
- markrender-1.0.7/markrender.egg-info/requires.txt +0 -11
- markrender-1.0.7/tests/test_emoji_note.py +0 -27
- markrender-1.0.7/tests/test_enhancements.py +0 -100
- markrender-1.0.7/tests/test_formatters.py +0 -121
- markrender-1.0.7/tests/test_inline_formatting_contexts.py +0 -44
- markrender-1.0.7/tests/test_new_features.py +0 -365
- markrender-1.0.7/tests/test_parser.py +0 -116
- markrender-1.0.7/tests/test_renderer.py +0 -277
- markrender-1.0.7/tests/test_renderer_edge_cases.py +0 -137
- markrender-1.0.7/tests/test_v1_0_5_features.py +0 -233
- {markrender-1.0.7 → markrender-1.1.0}/markrender.egg-info/dependency_links.txt +0 -0
- {markrender-1.0.7 → markrender-1.1.0}/markrender.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Unit test / coverage reports
|
|
35
|
+
htmlcov/
|
|
36
|
+
.tox/
|
|
37
|
+
.nox/
|
|
38
|
+
.coverage
|
|
39
|
+
.coverage.*
|
|
40
|
+
.cache
|
|
41
|
+
nosetests.xml
|
|
42
|
+
coverage.xml
|
|
43
|
+
*.cover
|
|
44
|
+
*.py,cover
|
|
45
|
+
.hypothesis/
|
|
46
|
+
.pytest_cache/
|
|
47
|
+
|
|
48
|
+
# Virtual environments
|
|
49
|
+
venv/
|
|
50
|
+
ENV/
|
|
51
|
+
env/
|
|
52
|
+
.venv
|
|
53
|
+
|
|
54
|
+
# IDEs
|
|
55
|
+
.vscode/
|
|
56
|
+
.idea/
|
|
57
|
+
*.swp
|
|
58
|
+
*.swo
|
|
59
|
+
*~
|
|
60
|
+
|
|
61
|
+
# OS
|
|
62
|
+
.DS_Store
|
|
63
|
+
Thumbs.db
|
|
64
|
+
|
|
65
|
+
# Project specific
|
|
66
|
+
*.log
|
|
67
|
+
.ruff_cache/
|
|
68
|
+
markrender/_version.py
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# test files
|
|
72
|
+
test_all_fixes.py
|
|
73
|
+
test_emoji.py
|
|
74
|
+
test_simple.py
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Praneeth Gandodi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Praneeth Gandodi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: markrender
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Professional terminal markdown renderer for streaming LLM responses
|
|
5
|
+
Author: Praneeth Gandodi
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Praneeth-Gandodi/markrender
|
|
8
|
+
Project-URL: Documentation, https://github.com/Praneeth-Gandodi/markrender#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/Praneeth-Gandodi/markrender
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/Praneeth-Gandodi/markrender/issues
|
|
11
|
+
Keywords: markdown,terminal,rendering,streaming,llm,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Requires-Python: >=3.7
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: pygments>=2.7.0
|
|
26
|
+
Requires-Dist: emoji>=2.8.0
|
|
27
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# MarkRender
|
|
34
|
+
|
|
35
|
+
**Professional Terminal Markdown Renderer for Streaming LLM Responses**
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Streaming Support** - Designed for chunk-by-chunk LLM response rendering
|
|
42
|
+
- **7 Themes** - github-dark, monokai, dracula, nord, one-dark, solarized-dark, solarized-light
|
|
43
|
+
- **Syntax Highlighting** - Powered by Pygments with 500+ languages
|
|
44
|
+
- **Dim Mode** - Render content in dimmed/reduced colors for "thinking" sections
|
|
45
|
+
- **Theme Preview** - Preview all themes with sample content via CLI
|
|
46
|
+
- **Line Numbers** - Optional line numbers in code blocks
|
|
47
|
+
- **Tables** - Table rendering with borders and overflow truncation
|
|
48
|
+
- **Checkboxes** - Task list support
|
|
49
|
+
- **Emoji Support** - Converts `:emoji_name:` to actual emojis
|
|
50
|
+
- **Links** - Styled hyperlinks with URLs
|
|
51
|
+
- **Full Markdown** - Headings, lists, blockquotes, horizontal rules, alerts, and more
|
|
52
|
+
- **Force Color** - Force color output even in non-tty terminals
|
|
53
|
+
- **Customizable** - Custom colors, backgrounds, and formatting options
|
|
54
|
+
- **Python 3.7+** - Compatible with Python 3.7 and above
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install git+https://github.com/Praneeth-Gandodi/markrender.git
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or install from source:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/Praneeth-Gandodi/markrender.git
|
|
66
|
+
cd markrender
|
|
67
|
+
pip install -e .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
````python
|
|
73
|
+
from markrender import MarkdownRenderer
|
|
74
|
+
|
|
75
|
+
# Create renderer with default theme
|
|
76
|
+
renderer = MarkdownRenderer()
|
|
77
|
+
|
|
78
|
+
# Render markdown content
|
|
79
|
+
markdown_text = """
|
|
80
|
+
# Hello World
|
|
81
|
+
|
|
82
|
+
This is **bold** and this is *italic*.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
def hello():
|
|
86
|
+
print("Hello from MarkRender!")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
- Item 1
|
|
91
|
+
- Item 2
|
|
92
|
+
- [x] Completed task
|
|
93
|
+
- [ ] Pending task
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
renderer.render(markdown_text)
|
|
97
|
+
renderer.finalize()
|
|
98
|
+
````
|
|
99
|
+
|
|
100
|
+
### Streaming LLM Responses
|
|
101
|
+
|
|
102
|
+
Perfect for rendering streaming responses from LLM APIs:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from markrender import MarkdownRenderer
|
|
106
|
+
from openai import OpenAI
|
|
107
|
+
|
|
108
|
+
client = OpenAI()
|
|
109
|
+
renderer = MarkdownRenderer(theme='github-dark')
|
|
110
|
+
|
|
111
|
+
stream = client.chat.completions.create(
|
|
112
|
+
model="gpt-4",
|
|
113
|
+
messages=[{"role": "user", "content": "Explain quantum computing"}],
|
|
114
|
+
stream=True
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
for chunk in stream:
|
|
118
|
+
content = chunk.choices[0].delta.content
|
|
119
|
+
if content:
|
|
120
|
+
renderer.render(content)
|
|
121
|
+
|
|
122
|
+
renderer.finalize()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Dim Mode
|
|
126
|
+
|
|
127
|
+
Use dim mode for "thinking" sections or less prominent content:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from markrender import MarkdownRenderer
|
|
131
|
+
|
|
132
|
+
renderer = MarkdownRenderer()
|
|
133
|
+
|
|
134
|
+
# Normal rendering
|
|
135
|
+
renderer.render("This is **normal** content")
|
|
136
|
+
|
|
137
|
+
# Dim/reduced color rendering
|
|
138
|
+
renderer.render("This content is dimmed and less prominent", dim_mode=True)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Theme Preview
|
|
142
|
+
|
|
143
|
+
Preview all available themes from the CLI:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
markrender --preview-themes
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Themes
|
|
150
|
+
|
|
151
|
+
MarkRender includes 7 professional color themes:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
themes = [
|
|
155
|
+
'github-dark', # GitHub's dark theme (default)
|
|
156
|
+
'monokai', # Popular Monokai theme
|
|
157
|
+
'dracula', # Dracula theme
|
|
158
|
+
'nord', # Nord color palette
|
|
159
|
+
'one-dark', # Atom One Dark
|
|
160
|
+
'solarized-dark', # Solarized Dark
|
|
161
|
+
'solarized-light' # Solarized Light
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
renderer = MarkdownRenderer(theme='dracula')
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
List available themes:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
markrender --list-themes
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Configuration
|
|
174
|
+
|
|
175
|
+
### Python API
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from markrender import MarkdownRenderer
|
|
179
|
+
from markrender.colors import rgb
|
|
180
|
+
|
|
181
|
+
renderer = MarkdownRenderer(
|
|
182
|
+
theme='monokai', # Color theme
|
|
183
|
+
code_background=False, # Show background in code blocks
|
|
184
|
+
line_numbers=True, # Show line numbers in code
|
|
185
|
+
inline_code_color=rgb(255, 100, 200), # Custom inline code color
|
|
186
|
+
width=100, # Terminal width (auto-detect by default)
|
|
187
|
+
force_color=False, # Force color output
|
|
188
|
+
stream_code=True # Stream code lines as they arrive
|
|
189
|
+
)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Parameters
|
|
193
|
+
|
|
194
|
+
- **theme** (str): Color theme name (default: `'github-dark'`)
|
|
195
|
+
- **code_background** (bool): Show background in code blocks (default: `False`)
|
|
196
|
+
- **line_numbers** (bool): Show line numbers in code blocks (default: `True`)
|
|
197
|
+
- **inline_code_color** (str): Custom ANSI color code for inline code (default: theme default)
|
|
198
|
+
- **width** (int): Terminal width in characters (default: auto-detect)
|
|
199
|
+
- **force_color** (bool): Force color output even if terminal does not support it (default: `False`)
|
|
200
|
+
- **stream_code** (bool): Render code lines as they arrive instead of buffering (default: `True`)
|
|
201
|
+
- **output** (file): Output stream (default: `sys.stdout`)
|
|
202
|
+
|
|
203
|
+
### CLI Usage
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
markrender README.md
|
|
207
|
+
markrender --theme dracula file.md
|
|
208
|
+
cat file.md | markrender
|
|
209
|
+
markrender --preview-themes
|
|
210
|
+
markrender --list-themes
|
|
211
|
+
markrender --no-line-numbers --code-background file.md
|
|
212
|
+
markrender --width 80 --force-color file.md
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Config File
|
|
216
|
+
|
|
217
|
+
MarkRender supports TOML configuration files. Place a `.markrender.toml` in your current directory or `~/.markrender/config.toml`:
|
|
218
|
+
|
|
219
|
+
```toml
|
|
220
|
+
[theme]
|
|
221
|
+
name = "github-dark"
|
|
222
|
+
|
|
223
|
+
[rendering]
|
|
224
|
+
code_background = false
|
|
225
|
+
line_numbers = true
|
|
226
|
+
|
|
227
|
+
[output]
|
|
228
|
+
# width = 80
|
|
229
|
+
force_color = false
|
|
230
|
+
|
|
231
|
+
[features]
|
|
232
|
+
stream_code = true
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Supported Markdown Features
|
|
236
|
+
|
|
237
|
+
### Headings
|
|
238
|
+
```markdown
|
|
239
|
+
# H1 Heading
|
|
240
|
+
## H2 Heading
|
|
241
|
+
### H3 Heading
|
|
242
|
+
#### H4 Heading
|
|
243
|
+
##### H5 Heading
|
|
244
|
+
###### H6 Heading
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Code Blocks
|
|
248
|
+
````markdown
|
|
249
|
+
```python
|
|
250
|
+
def example():
|
|
251
|
+
return "Syntax highlighted!"
|
|
252
|
+
```
|
|
253
|
+
````
|
|
254
|
+
|
|
255
|
+
### Inline Code
|
|
256
|
+
```markdown
|
|
257
|
+
Use `inline code` for short snippets.
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Tables
|
|
261
|
+
```markdown
|
|
262
|
+
| Feature | Supported |
|
|
263
|
+
|---------|-----------|
|
|
264
|
+
| Tables | Yes |
|
|
265
|
+
| Borders | Yes |
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Lists
|
|
269
|
+
```markdown
|
|
270
|
+
- Unordered item 1
|
|
271
|
+
- Unordered item 2
|
|
272
|
+
- Nested item
|
|
273
|
+
|
|
274
|
+
1. Ordered item 1
|
|
275
|
+
2. Ordered item 2
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Checkboxes
|
|
279
|
+
```markdown
|
|
280
|
+
- [x] Completed task
|
|
281
|
+
- [ ] Pending task
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Blockquotes
|
|
285
|
+
```markdown
|
|
286
|
+
> This is a blockquote
|
|
287
|
+
> It can span multiple lines
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Alerts (GitHub-flavored)
|
|
291
|
+
```markdown
|
|
292
|
+
> [!NOTE]
|
|
293
|
+
> Useful information users should know
|
|
294
|
+
|
|
295
|
+
> [!TIP]
|
|
296
|
+
> Helpful advice
|
|
297
|
+
|
|
298
|
+
> [!IMPORTANT]
|
|
299
|
+
> Key information
|
|
300
|
+
|
|
301
|
+
> [!WARNING]
|
|
302
|
+
> Urgent information
|
|
303
|
+
|
|
304
|
+
> [!CAUTION]
|
|
305
|
+
> Potential negative consequences
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Links
|
|
309
|
+
```markdown
|
|
310
|
+
[Link text](https://example.com)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Text Formatting
|
|
314
|
+
```markdown
|
|
315
|
+
**Bold text**
|
|
316
|
+
*Italic text*
|
|
317
|
+
***Bold and italic***
|
|
318
|
+
~~Strikethrough~~
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Emojis
|
|
322
|
+
```markdown
|
|
323
|
+
Hello :wave: Let's :rocket: go!
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Horizontal Rules
|
|
327
|
+
```markdown
|
|
328
|
+
---
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Use Cases
|
|
332
|
+
|
|
333
|
+
- **AI Chat Applications** - Render LLM responses in CLI tools
|
|
334
|
+
- **Documentation Viewers** - Display markdown documentation in terminal
|
|
335
|
+
- **Code Review Tools** - Show code diffs and comments
|
|
336
|
+
- **Note-Taking Apps** - Terminal-based markdown note viewers
|
|
337
|
+
- **Log Viewers** - Render structured logs with markdown
|
|
338
|
+
|
|
339
|
+
## Development
|
|
340
|
+
|
|
341
|
+
### Setup Development Environment
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
git clone https://github.com/Praneeth-Gandodi/markrender.git
|
|
345
|
+
cd markrender
|
|
346
|
+
python -m venv venv
|
|
347
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
348
|
+
pip install -e ".[dev]"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Run Tests
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
pytest tests/ -v
|
|
355
|
+
pytest tests/ --cov=markrender --cov-report=html --cov-report=term
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Run Examples
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
python examples/basic_usage.py
|
|
362
|
+
python examples/streaming_demo.py
|
|
363
|
+
python examples/theme_showcase.py
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Releasing
|
|
367
|
+
|
|
368
|
+
The package version is derived from git tags by `setuptools_scm`, so there is
|
|
369
|
+
no version number to edit by hand.
|
|
370
|
+
|
|
371
|
+
1. Open **Actions → Publish → Run workflow**.
|
|
372
|
+
2. Choose `auto` (recommended) or an explicit `patch`, `minor`, or `major` bump.
|
|
373
|
+
3. The workflow runs the tests, creates the next `vX.Y.Z` tag, builds the
|
|
374
|
+
sdist and wheel, publishes to PyPI, and creates a GitHub release.
|
|
375
|
+
|
|
376
|
+
With `auto`, commit messages since the last tag decide the bump:
|
|
377
|
+
|
|
378
|
+
- `feat!:` or a `BREAKING CHANGE:` footer → major
|
|
379
|
+
- `feat:` → minor
|
|
380
|
+
- everything else → patch
|
|
381
|
+
|
|
382
|
+
Publishing uses PyPI Trusted Publishing (OIDC), so no API token is stored in
|
|
383
|
+
the repository. Configure it once:
|
|
384
|
+
|
|
385
|
+
- **PyPI:** project `markrender` → Publishing → add a trusted publisher with
|
|
386
|
+
owner `Praneeth-Gandodi`, repository `markrender`, workflow `publish.yml`,
|
|
387
|
+
environment `pypi`.
|
|
388
|
+
- **GitHub:** Settings → Environments → create an environment named `pypi`.
|
|
389
|
+
|
|
390
|
+
The repository default workflow permission can stay read-only; the workflow
|
|
391
|
+
requests `contents: write` only for the jobs that create the tag and release.
|
|
392
|
+
|
|
393
|
+
You can also publish an existing tag directly:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
git tag v1.1.0
|
|
397
|
+
git push origin v1.1.0
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
To publish automatically after every merge to `main`, uncomment the `branches:
|
|
401
|
+
[main]` trigger in `.github/workflows/publish.yml`.
|
|
402
|
+
|
|
403
|
+
## License
|
|
404
|
+
|
|
405
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|