# Is there a way to format text in CommonMark?

**URL:** <https://talk.commonmark.org/t/is-there-a-way-to-format-text-in-commonmark/3377>\
**Category:** Application\
**Created:** [March 4, 2020, 1:48pm UTC](https://talk.commonmark.org/t/is-there-a-way-to-format-text-in-commonmark/3377 "2020-03-04T13:48:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon62197958](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/a/7feea3/32.png) [@anon62197958](https://talk.commonmark.org/u/anon62197958)\
**Post date:** [March 4, 2020, 1:48pm UTC](https://talk.commonmark.org/t/is-there-a-way-to-format-text-in-commonmark/3377/1 "2020-03-04T13:48:16Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![hukkinj1](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/hukkinj1/32/1993_2.png) [@hukkinj1](https://talk.commonmark.org/u/hukkinj1)\
**Post date:** [July 30, 2020, 7:53pm UTC](https://talk.commonmark.org/t/is-there-a-way-to-format-text-in-commonmark/3377/2 "2020-07-30T19:53:43Z")

</div>

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

Install:

```bash
pip install mdformat

```

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

```bash
mdformat -

```

Format file.md:

```bash
mdformat file.md

```

Check if a file is formatted:

```bash
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.
