markdown-code-blocks
A stupid simple bit of code which combines mistune and pygments to convert markdown into html. Very similar to github markdown, but for python.
Installation
pip install markdown-code-blocks
Usage
The library provides a single function highlight which takes in a markdown
string and returns html.
You can also use the cli markdown-code-blocks-highlight. It optionally
takes a single filename (defaulting to stdin) and writes to stdout.
For example:
markdown-code-blocks-highlight f.md > f.htm
pygments css
I'd suggest grabbing a theme file from pygments-css (or any other provider of pygments themes -- if you google there's a bunch of them).
This library will use the class .highlight so be sure to change out whatever
class the theme uses with that.
Most themes (for whatever reason) don't add styles for diff display. I usually do something like this:
.highlight .gi { color: #070; }
.highlight .gd { color: #911; }
Release files for markdown-code-blocks 3.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 | |
|---|---|---|---|
| markdown_code_blocks-3.2.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| markdown_code_blocks-3.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / markdown_code_blocks-3.2.0.tar.gz
| Download URL | markdown_code_blocks-3.2.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa9c4de3b3655cff7fbb90daee50f5346f8998496402a3ade4ff4be8fac8166a
|
|
BLAKE2b-256 checksum How to use checksums |
3bd0c0261f983f3216c0eed0048e0439cd7c9b29a1faf3e82fdb46da683659f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / markdown_code_blocks-3.2.0-py2.py3-none-any.whl
| Download URL | markdown_code_blocks-3.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c12a65c498453c8fab07000858dcaf4aa35d49dde62b183bbeefc91b06c355f6
|
|
BLAKE2b-256 checksum How to use checksums |
fa996329f0d5ad66762b35e01169c2473c67a24c3e024fa7c09acfc09357ceba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|