https://github.com/cloudblue/connect-markdown-renderer
https://github.com/cloudblue/connect-markdown-renderer
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cloudblue/connect-markdown-renderer
- Owner: cloudblue
- License: apache-2.0
- Created: 2020-10-09T08:50:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-29T15:29:56.000Z (about 3 years ago)
- Last Synced: 2026-01-06T13:56:56.305Z (5 months ago)
- Language: Python
- Size: 333 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CloudBlue Connect Markdown Renderer
 [](https://pypi.org/project/connect-markdown-renderer/) [](https://github.com/cloudblue/connect-markdown-renderer/actions) [](https://codecov.io/gh/cloudblue/connect-markdown-renderer) [](https://sonarcloud.io/dashboard?id=markdown-renderer)
## Introduction
`connect-markdown-renderer` is a small library that allow to render markdown documents in a terminal shell.
## Install
`connect-markdown-renderer` can be installed from pypi.org with pip:
```sh
$ pip install connect-markdown-renderer
```
## Usage example
```python
from connect.utils.terminal.markdown import render
my_md = """
# Heading level 1 - Paragraph
This is a paragraph with inline formatting like *italic*, **strong**, ~~strikethrough~~, `inline code` and :clapping_hands: emojis!.
## Heading level 2 - Lists
*Ordered list:*
1. First item
2. Second item
3. Third item
**Unordered list:**
* First
* Second
* Third
### Heading level 3 - blockquote
> This is a blockquote.
> > ...and a nested blockquote.
#### Heading level 4 - tables
| Col 1 | Col 2 | Col 3 |
|:------|:-----:|------:|
| a | b | c |
##### Heading level 5 - codeblock
```python
def this_is_my_python_function(args):
return 'Hello World!'
"""
print(render(my_md))
```
This code will produce the following output:

## Features
`connect-markdown-renderer` uses the new [markdown-it-py](https://github.com/executablebooks/markdown-it-py) parser and supports
[CommonMark](https://commonmark.org) plus the following extensions:
* tables
* strikethrough
* emoji
`connect-markdown-renderer` uses [rich](https://github.com/Textualize/rich) to render the markdown in the terminal.
## License
`connect-markdown-renderer` is released under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).