Metadata-Version: 2.4
Name: markrender
Version: 1.0.1
Summary: Professional terminal markdown renderer for streaming LLM responses
Author: Praneeth Gandodi
License-Expression: MIT
Project-URL: Homepage, https://github.com/Praneeth-Gandodi/markrender
Project-URL: Documentation, https://github.com/Praneeth-Gandodi/markrender#readme
Project-URL: Repository, https://github.com/Praneeth-Gandodi/markrender
Project-URL: Bug Tracker, https://github.com/Praneeth-Gandodi/markrender/issues
Keywords: markdown,terminal,rendering,streaming,llm,cli
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygments~=2.19.2
Requires-Dist: emoji~=2.15.0
Requires-Dist: rich~=14.3.2
Requires-Dist: colorama~=0.4.6
Provides-Extra: dev
Requires-Dist: pytest~=6.0.0; extra == "dev"
Requires-Dist: pytest-cov~=2.10.0; extra == "dev"
Dynamic: license-file

# MarkRender

MarkRender is a Python library for rendering Markdown in the terminal. It is designed to be highly customizable and is particularly well-suited for streaming content, such as responses from Large Language Models (LLMs).

## Key Features

*   **Streaming Support**: MarkRender can process and render Markdown content as it arrives, providing a smooth and responsive experience for dynamic content.
*   **Syntax Highlighting**: Code blocks are highlighted using the powerful Pygments library, supporting a wide range of languages.
*   **Theming**: Choose from a variety of built-in themes to customize the appearance of your rendered output.
*   **Table Rendering**: Tables are rendered with proper formatting and alignment, powered by the `rich` library.
*   **Markdown Compatibility**: Supports a wide range of Markdown features, including headings, lists, blockquotes, and more.
*   **Cross-Platform**: Works on Windows, macOS, and Linux.

## Installation

You can install MarkRender using pip:

```bash
pip install markrender
```

For development, you can clone the repository and install it in editable mode:

```bash
git clone https://github.com/Praneeth-Gandodi/markrender.git
cd markrender
pip install -e .
```

## Basic Usage

To render a Markdown string, create a `MarkdownRenderer` instance and use its `render` method:

```python
from markrender import MarkdownRenderer

renderer = MarkdownRenderer()

markdown_text = """
# Example Document

This is a sample Markdown document to demonstrate the capabilities of MarkRender.

## Text Formatting

You can use various text formatting options, such as:

- **Bold text**
- *Italic text*
- `Inline code`

## Code Blocks

```python
def hello_world():
    print("Hello, from MarkRender!")
```

## Tables

| Feature         | Supported |
| --------------- | :-------: |
| Streaming       |    Yes    |
| Syntax Highlighting |    Yes    |
| Theming         |    Yes    |

"""

renderer.render(markdown_text)
renderer.finalize()
```

## Streaming Usage

MarkRender is ideal for rendering content that arrives in chunks, such as from an API response. The `render` method can be called multiple times with partial content.

```python
import time
from markrender import MarkdownRenderer

renderer = MarkdownRenderer()

markdown_stream = [
    "# Streaming Example\n\n",
    "This text is being rendered in chunks.\n\n",
    "```python\n",
    "for i in range(5):\n",
    "    print(i)\n",
    "```\n",
]

for chunk in markdown_stream:
    renderer.render(chunk)
    time.sleep(0.5)

renderer.finalize()
```

## Customization

The `MarkdownRenderer` can be customized with various options:

```python
from markrender import MarkdownRenderer

renderer = MarkdownRenderer(
    theme='monokai',
    line_numbers=True,
    code_background=True,
    force_color=True,
    stream_code=True
)
```

**Available Options:**

*   `theme`: The color theme to use for syntax highlighting.
*   `line_numbers`: Whether to display line numbers in code blocks.
*   `code_background`: Whether to add a background color to code blocks.
*   `force_color`: If `True`, forces color output even if the terminal does not appear to support it.
*   `stream_code`: If `False`, code blocks are rendered all at once at the end, rather than line by line.

## Available Themes

*   `github-dark`
*   `monokai`
*   `dracula`
*   `nord`
*   `one-dark`
*   `solarized-dark`
*   `solarized-light`

## Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/Praneeth-Gandodi/markrender).

## License

MarkRender is distributed under the MIT License. See the `LICENSE` file for more details.
