Jump to the navigation menu

Formatting Markdown files with Prettier

As well as JavaScript and Twig files, Prettier can also format Markdown files like the one for this blog post.

Whether to hard-wrap lines of text in Markdown files has been a ongoing question for me, and now I can fix all my posts easily.

To re-format all my Markdown files with wrapped lines, I can run:

prettier -w --prose-wrap always "source/**/*.md"

If I don't want wrapping, I can run:

prettier -w --prose-wrap never "source/**/*.md"

Either way, all my source files will be consistent.