Skip to main content

CommonMark compliant Markdown formatter

Project description

Documentation Status Build Status codecov.io PyPI version

mdformat

CommonMark compliant Markdown formatter

Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files. Mdformat is a Unix-style command-line tool as well as a Python library.

Find out more in the docs.

Installing

Install with CommonMark support:

pip install mdformat

Alternatively install with GitHub Flavored Markdown (GFM) support:

pip install mdformat-gfm

Command line usage

Format files

Format files README.md and CHANGELOG.md in place

mdformat README.md CHANGELOG.md

Format .md files in current working directory recursively

mdformat .

Read Markdown from standard input until EOF. Write formatted Markdown to standard output.

mdformat -

Check formatting

mdformat --check README.md CHANGELOG.md

This will not apply any changes to the files. If a file is not properly formatted, the exit code will be non-zero.

Options

foo@bar:~$ mdformat --help
usage: mdformat [-h] [--check] [--version] [--number]
                [--wrap {keep,no,INTEGER}]
                [paths [paths ...]]

CommonMark compliant Markdown formatter

positional arguments:
  paths                 files to format

optional arguments:
  -h, --help            show this help message and exit
  --check               do not apply changes to files
  --version             show program's version number and exit
  --number              apply consecutive numbering to ordered lists
  --wrap {keep,no,INTEGER}
                        paragraph word wrap mode (default: keep)

Documentation

This README merely provides a quickstart guide for the command line interface. For more information refer to the documentation. Here's a few pointers to get you started:

Frequently Asked Questions

What's wrong with the mdformat logo? It renders incorrectly and is just terrible in general.

Nope, the logo is actually pretty great – you're terrible. The logo is more a piece of art than a logo anyways, depicting the horrors of poorly formatted text documents. I made it myself.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdformat-0.6.2.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

mdformat-0.6.2-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file mdformat-0.6.2.tar.gz.

File metadata

  • Download URL: mdformat-0.6.2.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1041-azure

File hashes

Hashes for mdformat-0.6.2.tar.gz
Algorithm Hash digest
SHA256 79c4589819f2ca0261428829171eb93b6c89e57c43627738d493ae11431cc3eb
MD5 6cf03ba44366dc53eaedc68d6fd85ecd
BLAKE2b-256 515c6f0c38163c3493a261d5d9e0d026de9fd16bfa8caf7ac763800d022b1b77

See more details on using hashes here.

File details

Details for the file mdformat-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: mdformat-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1041-azure

File hashes

Hashes for mdformat-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d2c1d0125d34950c17a022adf45c588b1b2b2f0e47c7f9dcc4f87cef2779499
MD5 59c6678574f29cd0f9519222795b1db8
BLAKE2b-256 bf200923965e7f3f360be134b9acde8359fa8fa4c532c0cf009a089b5eade1fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page