Install & Compatibility
Where this runs
tested against v1.0.0 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.362s · 26.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.1s · import 0.340s · 27MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
mdformat_tables
✓ import mdformat_tables
Importing the package registers it as an mdformat plugin. Its functionality is then accessed via `mdformat`'s API or CLI using the plugin name 'tables'.
This example demonstrates how to use `mdformat-tables` programmatically. By simply importing `mdformat_tables`, the plugin is registered with `mdformat`. You then pass `plugins=['tables']` to `mdformat.format_markdown` to enable table formatting.
import mdformat
import mdformat_tables # This registers the plugin
markdown_with_table = """
| Header 1 | Header 2 |
|----------|----------|
| Row 1 Col 1 | Row 1 Col 2 |
| Row 2 Col 1 | Row 2 Col 2 |
"""
formatted_markdown = mdformat.format_markdown(markdown_with_table, plugins=['tables'])
print(formatted_markdown)
Debug
Known issues
breakingPython 3.6 support was dropped in `v1.0.0`. Users on older Python versions must either upgrade their Python environment or pin `mdformat-tables` to an earlier version (e.g., `<1.0.0`).fixUpgrade to Python 3.7+ or pin `mdformat-tables<1.0.0`.
affects: >=1.0.0
gotchaCompatibility with `mdformat` versions is crucial. `mdformat-tables` versions are often synced with specific `mdformat` versions due to internal API changes (e.g., `v0.3.0` synced with `mdformat 0.6.0`). Mismatched versions can lead to unexpected formatting or errors.fixAlways install the latest `mdformat-tables` with the latest `mdformat` or consult their respective changelogs for specific compatibility notes. Ensure both libraries are kept up-to-date in sync.
affects: <1.0.0 (especially before v0.3.0)
gotchaPrior to `v0.4.1`, tables containing unescaped pipe characters (`|`) within cells could be incorrectly rendered or parsed, leading to malformed output.fixUpgrade to `mdformat-tables>=0.4.1` to ensure correct pipe escaping and table parsing.
affects: <0.4.1
gotchaBefore `v0.4.0`, lines that visually resembled table delimiter rows (e.g., `--- | ---`) but were not intended as such could be misinterpreted and incorrectly escaped, affecting non-table content.fixUpgrade to `mdformat-tables>=0.4.0` for improved handling of potential table delimiter rows.
affects: <0.4.0
Upgrade
Version history
1.0.0latest on PyPI · released Aug 23, 2024
Audit
Dependencies
mdformatrequiredThis package is an mdformat plugin and requires mdformat to function.