Is there a way to format text in CommonMark?

Is there a way to format text in CommonMark?
I’ve tried this
cmark -t commonmark file.md …
but it only works. if you create a new file.

Hi! You might be interested in mdformat which is a formatter I recently wrote in Python: https://github.com/hukkinj1/mdformat

Install:

pip install mdformat

Read commonmark (until EOF) from stdin, print formatted commonmark to stdout:

mdformat -

Format file.md:

mdformat file.md

Check if a file is formatted:

mdformat --check file.md && echo "File is formatted!"

Should work on macOS, Linux and Windows, although I’ve personally only ever ran it on Linux.

1 Like