HUGO

Hugo and Prettier

It is not a Hugo question. I am a Vim user and would like to use prettier for Hugo. The question is, how can I configure prettier for the md and html files?

Try adding "proseWrap": "always" to you your .prettierrc. Docs: https://prettier.io/docs/en/options.html#prose-wrap

1 Like

It works fine. Thank you

I wrote a small plugin for prettier, which formats html without breaking the {{ }}:

prettier-plugin-go-template

To use it with GoHugo or basic .html files, you’ll have to override the used parser inside your .prettierrc file:

{
  "overrides": [
    {
      "files": ["*.html"],
      "options": {
        "parser": "go-template"
      }
    }
  ]
}
1 Like