Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyromark

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyromark

Blazingly fast Markdown parser

  • 0.7.0
  • PyPI
  • Socket score

Maintainers
1

pyromark

CI Downloads

pyromark (stands for Python Rust Optimized Markdown) is a blazingly fast CommonMark-compliant Markdown parser for Python.

Uses pulldown-cmark Rust crate under the hood.

Installation

pip install -U pyromark

Documentation

https://pyromark.readthedocs.io

Basic examples

See documentation for more comprehensive examples.

Convert Markdown to HTML
import pyromark

html = pyromark.html("# Hello world")
assert html == "<h1>Hello world</h1>\n"
Iterating over Markdown elements
import pyromark

for event in pyromark.events("# Hello world"):
    # All event types are fully type annotated
    # so you will get static type checking
    # and Tab completions in your IDE!
    match event:
        case {"Start": {"Heading": {"level": heading_level}}}:
            print(f"Heading with {heading_level} level started")
        case {"Text": text}:
            print(f"Got {text!r} text")
        case {"End": {"Heading": heading_level}}:
            print(f"Heading with {heading_level} level ended")
        case other_event:
            print(f"Got {other_event!r}")

Performance

130x faster than Markdown, 101x faster than markdown-it-py, 71x faster than mistune, 8x faster than markdown-it-pyrs.

If you use threading, the difference with other libraries will be even more enormous, since pyromark releases the GIL.

See benchmark.

License

MIT

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc