Markdownify
raw JSON → 1.2.2 verified Tue May 12 auth: no python install: verified
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 Common errors
error ModuleNotFoundError: No module named 'markdownify' ↓
cause 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 error AttributeError: 'NoneType' object has no attribute 'strip' ↓
cause 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. error ValueError: The `strip` and `convert` options are mutually exclusive. ↓
cause 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']). Warnings
breaking The 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.
gotcha The `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.
gotcha When 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.
gotcha By 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.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 0.37s 19.3M
3.10 alpine (musl) - - 0.41s 19.3M
3.10 slim (glibc) wheel 1.7s 0.27s 20M
3.10 slim (glibc) - - 0.30s 20M
3.11 alpine (musl) wheel - 0.79s 21.4M
3.11 alpine (musl) - - 0.95s 21.4M
3.11 slim (glibc) wheel 1.8s 0.71s 22M
3.11 slim (glibc) - - 0.72s 22M
3.12 alpine (musl) wheel - 0.50s 13.2M
3.12 alpine (musl) - - 0.68s 13.2M
3.12 slim (glibc) wheel 1.7s 0.62s 14M
3.12 slim (glibc) - - 0.61s 14M
3.13 alpine (musl) wheel - 0.49s 13.0M
3.13 alpine (musl) - - 0.55s 12.9M
3.13 slim (glibc) wheel 1.7s 0.53s 13M
3.13 slim (glibc) - - 0.58s 13M
3.9 alpine (musl) wheel - 0.31s 18.8M
3.9 alpine (musl) - - 0.34s 18.8M
3.9 slim (glibc) wheel 2.0s 0.27s 19M
3.9 slim (glibc) - - 0.29s 19M
Imports
- markdownify
from markdownify import markdownify as md
Quickstart last tested: 2026-04-24
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)