Skip to main content

mdhtml2term

Render MDHTML Markdown in the terminal with Rich.

md_blocks parses Markdown with mdhtml and returns one Rich renderable per top-level block. A terminal app can then print, fold or replace each block on its own. ipyai uses it to render AI replies.

Install

pip install mdhtml2term

Usage

from rich.console import Console
from mdhtml2term import md_blocks

console = Console()
for block in md_blocks(markdown_text): console.print(block)

md_blocks takes a Markdown string and returns a list of Rich renderables. theme names the Pygments theme for code blocks and defaults to ansi_dark. Other keyword arguments go to mdhtml.parse_md. The shared Rust document engine resolves references and assigns numbers. Unresolved references show their target ids.

Supported content

  • Headings, paragraphs, block quotes, lists, code blocks, tables and horizontal rules. Block quotes and list items can hold any other block, including code and further quotes.
  • Bold, italic, inline code, strikethrough, highlight and line breaks.
  • Links, as OSC 8 hyperlinks followed by their address in brackets.
  • Images, as their alt text in square brackets.
  • Task list checkboxes, as [ ] and [x].
  • A numbered list that resumes after other content keeps its numbering.

Other inline elements show their text. Other block containers render their children. Raw payloads and unresolved template instructions are omitted.

Bibliographies use mdhtml's ::: bibliography syntax with explicit citation-author terms, ids, optional year attributes and formatted entry definitions. Citations and bibliography layout are prepared in Rust. md_blocks(..., cite_style='numeric') selects numbers in bibliography order; 'author-year' selects author-year text. None inherits frontmatter. Unresolved citation keys remain visible in drafts.

Metadata

Release files for mdhtml2term 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdhtml2term 0.1.2
File Size Uploaded Provenance Actions
mdhtml2term-0.1.2.tar.gz 9.9 kB Without provenance Details for mdhtml2term-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdhtml2term 0.1.2
File Interpreter ABI Platform Actions
mdhtml2term-0.1.2-py3-none-any.whl Python 3 none any Details for mdhtml2term-0.1.2-py3-none-any.whl

Total release size: 18.8 kB

Release files / mdhtml2term-0.1.2.tar.gz

Download URL mdhtml2term-0.1.2.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5b1e1128f35fd68453b162efac30e5fbc92d05771d621257ca21067dd48039fe
BLAKE2b-256 checksum
How to use checksums
f6ed71f5a5071ee6bbcc7053c82634badc21534789abd81194551b118da5ede0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / mdhtml2term-0.1.2-py3-none-any.whl

Download URL mdhtml2term-0.1.2-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
793ffa32b533dbaa9ce66eceb03067d5e6e2c6d1da4f83d372b46524d86f1737
BLAKE2b-256 checksum
How to use checksums
0658e6219ebf34c124a8c71f58bd6cc200ba7a6fc06fb245f499a08e2d189c05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for mdhtml2term 0.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page