NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹

Home Page:prettier-plugin-go-template-niklaspor.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug with parsing Hugo's safeHTMLAttr

gcushen opened this issue · comments

commented

Problem

<link rel="preload" as="style" {{ printf "href=\"https://fonts.googleapis.com/css2?%s&display=swap\"" . | safeHTMLAttr }}>

is converted to

<link rel="preload" as="style" <!--BPGT<!--BPGT<!--BPGTBPGT119EPGTEPGT-- />EPGT-- />EPGT-- /> />

Docs: https://gohugo.io/functions/safehtmlattr/

Note #24 reports a similar but different issue (it's unrelated to safeHTMLAttr). Perhaps when #24 is resolved, it might also resolve this one though.

Version: 0.0.10

Yes you're right for this one probably, go templates which are inside tags, but not inside attributes, are currently (sadly) not working.

This still looks like some more specific bug tho, I'll leave this open to be fixed after #24.

Fixed with #49 :

<link
  rel="preload"
  as="style"
  {{ printf "href=\"https://fonts.googleapis.com/css2?%s&display=swap\"" . | safeHTMLAttr }}
/>