hugo is a fantastic static site generator. prettier is a fantastic auto-formatter with support for markdown and the codeblocks inside markdown. To get the two to work together, we'll need to install some node dependencies. (alternatively, you could build a container with these dependencies and run it with a volume as a pre-commit hook)
Then add the following
lint-staged keys to
That's it. Add a new markdown file and watch it be formatted!
After implementing this in a precommit hook and in my editor I no longer have to worry about any formatting issues when I'm writing, which is fantastic!
Now I see this when committing new posts: