Registry / serialization / markdownify

markdownify

JSON →
library1.2.3pypypi✓ verified 10d ago

Markdownify is a Python library designed to convert HTML content into Markdown format. It is currently at version 1.2.2 and maintains an active development status with a healthy release cadence, frequently adding new features and addressing issues.

pip install markdownify
INSTALL
IMPORT
SIG · MARKDOWNIFY
M
markdownify
serializationpythonv1.2.3
Install
1.8s avg
Import
209ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.218s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.200s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

markdownify
from markdownify import markdownify as md

Convert a basic HTML string to Markdown. The `markdownify` function can be aliased as `md` for convenience.

from markdownify import markdownify as md html_content = "<h1>Hello World</h1><p>This is <b>bold</b> and <em>italic</em> text with a <a href=\"http://example.com\">link</a>.</p>" markdown_output = md(html_content) print(markdown_output)
Debug
Known issues
breakingThe interface for custom tag conversion functions (e.g., `convert_*()`) changed significantly in version 1.0.0. If you have custom conversion logic, it will need to be updated.
fix
Review the official documentation or GitHub release notes for version 1.0.0 (specifically PR #191) to understand the new function signature and adapt your custom converters accordingly.
affects: >=1.0.0
gotchaThe `strip` and `convert` options for `markdownify` are mutually exclusive. You cannot use both simultaneously.
fix
Choose either the `strip` option to define tags to remove, or the `convert` option to define tags to specifically process. Do not supply both arguments in the same call.
affects: All versions
gotchaWhen customizing BeautifulSoup parser options via the `beautiful_soup_parser` argument (added in v1.2.0), string or list values are treated as 'features' (e.g., 'lxml', 'html5lib'), while dictionary values are treated as full keyword arguments for the BeautifulSoup constructor.
fix
Ensure the format of the `beautiful_soup_parser` argument matches the intended use: pass a string/list for parser features or a dictionary for direct BeautifulSoup constructor kwargs.
affects: >=1.2.0
gotchaBy default, `markdownify` escapes asterisks (`*`) and underscores (`_`) that might be interpreted as Markdown formatting. If you want to disable this behavior, you need to explicitly set `escape_asterisks=False` or `escape_underscores=False`.
fix
Pass `escape_asterisks=False` and/or `escape_underscores=False` as keyword arguments to the `markdownify` function if you want to prevent these characters from being escaped.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'markdownify'
The `markdownify` library has not been installed in your Python environment, or the environment you are running your code in does not have it installed.
fix
Install the package using pip: `pip install markdownify`
AttributeError: 'NoneType' object has no attribute 'strip'
This error occurs when `markdownify` is called with `None` instead of a string, as the library expects HTML content as a string input to its primary function. A similar `AttributeError` like `'int' object has no attribute 'strip'` would occur if an integer or another non-string type were passed.
fix
Ensure that the input to the `markdownify` function is always a string containing HTML content. For example, `markdownify('')` for an empty string or `markdownify(html_content_variable)` where `html_content_variable` holds a string.
ValueError: The `strip` and `convert` options are mutually exclusive.
The `markdownify` library does not allow both the `strip` (blacklist of tags to remove) and `convert` (whitelist of tags to keep) options to be used simultaneously, as they define conflicting strategies for tag handling.
fix
Choose either the `strip` option or the `convert` option, but not both, when calling the `markdownify` function. For example, `markdownify(html, strip=['script'])` or `markdownify(html, convert=['b', 'i'])`.
Upgrade
Version history
1.2.3latest on PyPI · released Jun 30, 2026
Audit
Dependencies
beautifulsoup4requiredCore dependency for parsing HTML documents.
sixrequiredDependency for Python 2/3 compatibility.
Agent activity
13 hits · last 30 days
node
10
Amazon
2
Resources
markdownify — pip install markdownify · libregistry