
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Python bindings for the htmd Rust library, a fast HTML to Markdown converter.
pip install htmd-py
You can customise the HTML to Markdown conversion with the following options:
heading_style
: Style for headings (values from htmd.HeadingStyle
)hr_style
: Style for horizontal rules (values from htmd.HrStyle
)br_style
: Style for line breaks (values from htmd.BrStyle
)link_style
: Style for links (values from htmd.LinkStyle
)link_reference_style
: Style for referenced links (values from htmd.LinkReferenceStyle
)code_block_style
: Style for code blocks (values from htmd.CodeBlockStyle
)code_block_fence
: Fence style for code blocks (values from htmd.CodeBlockFence
)bullet_list_marker
: Marker for unordered lists (values from htmd.BulletListMarker
)preformatted_code
: Whether to preserve whitespace in inline code (boolean)skip_tags
: List of HTML tags to skip during conversion (list of strings)All options are exposed in a simple manner:
import htmd
# Simple conversion with default options
markdown = htmd.convert_html("<h1>Hello World</h1>")
print(markdown) # "# Hello World"
# Using custom options
options = htmd.Options()
options.heading_style = htmd.HeadingStyle.SETEX
options.bullet_list_marker = htmd.BulletListMarker.DASH
markdown = htmd.convert_html("<h1>Hello World</h1><ul><li>Item 1</li></ul>", options)
print(markdown)
# Skip specific HTML tags
options = htmd.create_options_with_skip_tags(["script", "style"])
markdown = htmd.convert_html("<h1>Hello</h1><script>alert('Hi');</script>", options)
print(markdown) # "# Hello" (script tag is skipped)
Refer to the htmd docs for all available options.
The module provides enumeration-like objects for all option values:
import htmd
# HeadingStyle
htmd.HeadingStyle.ATX # "atx"
htmd.HeadingStyle.SETEX # "setex"
# HrStyle
htmd.HrStyle.DASHES # "dashes"
htmd.HrStyle.ASTERISKS # "asterisks"
htmd.HrStyle.UNDERSCORES # "underscores"
# BrStyle
htmd.BrStyle.TWO_SPACES # "two_spaces"
htmd.BrStyle.BACKSLASH # "backslash"
# LinkStyle
htmd.LinkStyle.INLINED # "inlined"
htmd.LinkStyle.REFERENCED # "referenced"
# LinkReferenceStyle
htmd.LinkReferenceStyle.FULL # "full"
htmd.LinkReferenceStyle.COLLAPSED # "collapsed"
htmd.LinkReferenceStyle.SHORTCUT # "shortcut"
# CodeBlockStyle
htmd.CodeBlockStyle.INDENTED # "indented"
htmd.CodeBlockStyle.FENCED # "fenced"
# CodeBlockFence
htmd.CodeBlockFence.TILDES # "tildes"
htmd.CodeBlockFence.BACKTICKS # "backticks"
# BulletListMarker
htmd.BulletListMarker.ASTERISK # "asterisk"
htmd.BulletListMarker.DASH # "dash"
Tested with small (12 lines) and medium (1000 lines) markdown strings
Maintained by lmmx. Contributions welcome!
uv pip install -e .[dev]
)Licensed under the Apache License, Version 2.0.
FAQs
Python bindings for the htmd Rust library, a fast HTML to Markdown converter
We found that htmd-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.