I would love if there was a way to use the VS Code formatter or prettier to enforce rules like max line length for MDX files. It would make writing blog posts in MDX so much nicer. Does anyone have any methods for doing that?
The project I'm currently trying to do this on is a basic gatsby with mdx setup. It has eslint and prettier.
You'll need to provide the "Prose Wrap" option to prettier. I hoped it would be enabled by default, however that's not the case because some services use a linebreak-sensitive renderer.
CLI:
prettier --prose-wrap always
In config:
proseWrap: "always"
https://prettier.io/docs/en/options.html#prose-wrap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With