This article covers development-related setup for working with Hugo.
Editor Setup Link to this heading
- VS Code syntax highlighting and autocomplete: theNewDynamic/language-hugo-vscode (external link)
- JetBrains syntax highlighting and autocomplete: Smart Hugo (external link)
Formatter Setup Link to this heading
HTML Link to this heading
You can use a Prettier plugin to format HTML + Go template files.
npm install --save-dev prettier prettier-plugin-go-template.prettierrc
{
"plugins": ["prettier-plugin-go-template"],
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template"
}
}
]
}Format files with prettier --write --list-different FILE.
Alternatively, you can use Hugo's official gotmplfmt (external link). Compared to Prettier, its main differences are that it doesn't support any configuration options, doesn't support style or script tags, and isn't part of the npm ecosystem.
Markdown Link to this heading
rumdl (external link) is a Markdown LSP, not just a formatter, and it supports Hugo-specific conventions such as shortcodes, Markdown attributes (external link), and a custom root (external link), among others.