Skip to content

Invalid node root when using template in root element tag #120

@giggio

Description

@giggio

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions