air-markdown
Markdown = Air Tags + Mistletoe
- Free software: MIT License
- Documentation: https://air-markdown.readthedocs.io.
Features
- Handy
Markdown()Air Tag that renders Markdown into HTML. - Powerful
AirMarkdown()Air Tag that renders Markdown into HTML, including rendering of Air Tags inside ````air-live``` blocks. For example, if you have:
air.H2("Heading 2")
it will render as <h2>Heading 2</h2>.
Installation
Via uv:
uv add air-markdown
Or pip:
pip install air-markdown
Usage
from air_markdown import Markdown
Markdown('# Hello, world')
Renders as:
<h1>Hello, world.</h1>
Customizing the rendered HTML
Mistletoe allows for customization of the renderer through overloading of the Markdown.html_renderer property.
from air_markdown import Markdown
import mistletoe
class SupermanRenderer(mistletoe.HtmlRenderer):
def render_strong(self, token: mistletoe.span_token.Strong) -> str:
template = '<strong class="superman">{}</strong>'
return template.format(self.render_inner(token))
Markdown.html_renderer = SupermanRenderer
Now Markdown("**Look in the sky!**") renders
<p><strong class="superman">Look in the sky!</strong></p>\n
Wrapping Markdown output
If you need to wrap Markdown output, just override the Markdown.wrapper. So if you need all content to be wrapped by a section tag:
Markdown.wrapper = lambda self, x: f'<section>{x}</section>'
assert Markdown('# Big').render() == '<section><h1>Big</h1>\n</section>'
TailwindTypographyMarkdown()
Useful for when using Tailwind Typography, it wraps content in an <article class="prose"> tag.
html = TailwindTypographyMarkdown('# Tailwind support').render()
assert html == '<article class="prose"><h1>Tailwind support</h1>\n</article>'
Credits
This package was created with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.
Metadata
Release files for air-markdown 0.5.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 |
|---|---|---|---|---|
| air_markdown-0.5.0.tar.gz | 6.3 kB | Without provenance | Details for air_markdown-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| air_markdown-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for air_markdown-0.5.0-py3-none-any.whl |
Total release size: 11.6 kB
Release files / air_markdown-0.5.0.tar.gz
| Download URL | air_markdown-0.5.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a4d70a9c561b54b5ec6eb0ed6946ece56c33940c7bc8a087f1b37189a892005
|
|
BLAKE2b-256 checksum How to use checksums |
68abfb7a2ce8673249716cb70b084bc1d9c969af4436bad542f74fa296b6a173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / air_markdown-0.5.0-py3-none-any.whl
| Download URL | air_markdown-0.5.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85c756864f36755f636a8e25254832a6725b4bb150a0d92d202e006cdbadcab7
|
|
BLAKE2b-256 checksum How to use checksums |
ebf822fb05e8016e4fa0df06885627344843275602459a092f19300626bc375d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for air-markdown 0.5.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.