{"id":4983,"library":"mdformat-gfm","title":"Mdformat GFM","description":"Mdformat-gfm is an mdformat plugin that extends the core mdformat library to support GitHub Flavored Markdown (GFM) syntax extensions, including tables, task list items, strikethroughs, and autolinks. It allows mdformat to properly format Markdown files that utilize these GFM features. The library is currently at version 1.0.0 and typically releases new versions in sync with its parent library, mdformat.","status":"active","version":"1.0.0","language":"en","source_language":"en","source_url":"https://github.com/hukkin/mdformat-gfm","tags":["markdown","formatter","gfm","plugin","github flavored markdown"],"install":[{"cmd":"pip install mdformat mdformat-gfm","lang":"bash","label":"Install for general library usage"},{"cmd":"pipx install mdformat && pipx inject mdformat mdformat-gfm","lang":"bash","label":"Install for CLI usage (recommended for formatters)"}],"dependencies":[{"reason":"mdformat-gfm is a plugin for the mdformat formatter and requires it to function.","package":"mdformat"}],"imports":[{"note":"mdformat-gfm is an auto-discovered plugin; its functionality is accessed through the mdformat API by specifying extensions.","symbol":"mdformat","correct":"import mdformat"}],"quickstart":{"code":"import mdformat\n\nunformatted_gfm = \"\"\"\n# My GFM Document\n\n- [ ] Task list item\n- [x] Another task\n\n| Header 1 | Header 2 |\n| -------- | -------- |\n| Cell 1   | Cell 2   |\n\nThis is a ~~strikethrough~~ text.\n\"\"\"\n\n# To format a string with GFM support:\nformatted_text = mdformat.text(unformatted_gfm, extensions=['gfm'])\nprint(formatted_text)\n\n# To format a file in place:\n# with open('my_gfm_file.md', 'w') as f:\n#     f.write(unformatted_gfm)\n# mdformat.file('my_gfm_file.md', extensions=['gfm'])\n# with open('my_gfm_file.md', 'r') as f:\n#     print(f.read())\n","lang":"python","description":"This quickstart demonstrates how to use `mdformat` with the `mdformat-gfm` plugin via its Python API. The `mdformat-gfm` plugin is automatically loaded by `mdformat` once installed, and its GFM capabilities are enabled by passing `extensions=['gfm']` to `mdformat.text()` or `mdformat.file()`."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or later.","message":"mdformat-gfm, via its dependency on mdformat 1.0.0, no longer supports Python 3.9. Users must upgrade to Python 3.10 or newer.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Remove `mdformat-tables` and ensure `mdformat-gfm` is installed. Use the `gfm` extension for full GFM (including tables) support.","message":"The separate `mdformat-tables` plugin has been deprecated. Table formatting support is now included directly within `mdformat-gfm`. Users should migrate from `mdformat-tables` to `mdformat-gfm` for table support.","severity":"deprecated","affected_versions":"All versions"},{"fix":"It is highly recommended to pin the `mdformat` and `mdformat-gfm` dependencies to exact versions in your project to ensure consistent formatting results.","message":"There is no guarantee for a stable Markdown formatting style across `mdformat` versions (which `mdformat-gfm` depends on). Formatting output might change in minor or patch releases.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If conflicts arise, try updating all `mdformat` related plugins to their latest compatible versions or review the dependency trees for conflicting `markdown-it-py` or `mdit-py-plugins` requirements.","message":"Combining `mdformat-gfm` with other `mdformat` plugins (e.g., `mdformat-admon`) can sometimes lead to dependency conflicts, particularly with underlying `mdit-py-plugins` versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If precise table alignment is desired, ensure `--compact-tables` is not used in the CLI or `compact_tables` is set to `false` in your TOML configuration.","message":"The `mdformat-gfm` plugin allows configuration of 'compact tables' via a `--compact-tables` CLI option or `compact_tables` TOML boolean. When enabled, this strips extra spaces used for column alignment in GFM tables.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}