prettier-plugin-go-template
prettier-plugin-go-template copied to clipboard
`Invalid node root` when using template in root element tag
This will fail because of invalid root, but it is valid:
<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
{{- .Text -}}
</h{{ .Level }}>
This code is taken from the Hugo docs, so it is probably a common pattern.
I'm guessing it is the <h{{ .Level }} part that is faling.
Log is:
[error] layouts/blog/_markup/render-heading.html: Error: An error occured during printing. Found invalid node root.
[error] at Object.print (node_modules/prettier-plugin-go-template/lib/index.js:65:19
[error] at callPluginPrintFunction (node_modules/prettier/index.mjs:20175:20)
Did you manage to solve this?