mdformat-tables

1.0.0 · active · verified Mon Apr 13

mdformat-tables is a plugin for the `mdformat` markdown formatter, designed specifically for rendering tables according to the GitHub Flavored Markdown (GFM) specification. It ensures tables are consistently formatted and properly aligned. The library is actively maintained, with its current version being 1.0.0, and follows a stable release cadence driven by updates to `mdformat`.

Warnings

Install

Imports

Quickstart

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)

view raw JSON →