vscode-liquid icon indicating copy to clipboard operation
vscode-liquid copied to clipboard

Better support for inline svg

Open yegorandrosov opened this issue 1 year ago • 3 comments

Parser error due to inline <svg> containing <g> tag, but it is a valid HTML https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g

ERROR: Parse error occured when formatting document

> Syntax Error (line 11): Missing HTML "svg" end tag


10 | <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
11 |   <g opacity="0.7">


The "<svg>" tag type has an incomplete HTML syntactic structure resulting in a parse error.
To resolve the issue check that you have a closing "</svg>" tag. For more information
see: https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags


Language: Liquid
Location: 11
Æsthetic: Parse Failed (Code: 105)

Full html:

  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
      <g opacity="0.7">
          <path d="M4.23508 2.10991C4.16485 2.18023 4.12541 2.27554 4.12541 2.37491C4.12541 2.47429 4.16485 2.5696 4.23508 2.63991L7.59508 5.99991L4.23508 9.35991C4.19823 9.39424 4.16868 9.43565 4.14819 9.48164C4.12769 9.52764 4.11667 9.5773 4.11578 9.62765C4.11489 9.678 4.12416 9.72802 4.14302 9.77471C4.16188 9.82141 4.18995 9.86382 4.22556 9.89943C4.26117 9.93504 4.30358 9.96312 4.35028 9.98198C4.39697 10.0008 4.44699 10.0101 4.49734 10.0092C4.54769 10.0083 4.59735 9.9973 4.64335 9.9768C4.68935 9.95631 4.73075 9.92676 4.76508 9.88991L8.39008 6.26491C8.4603 6.1946 8.49975 6.09929 8.49975 5.99991C8.49975 5.90054 8.4603 5.80523 8.39008 5.73491L4.76508 2.10991C4.69476 2.03969 4.59945 2.00024 4.50008 2.00024C4.4007 2.00024 4.30539 2.03969 4.23508 2.10991Z" fill="#111111"/>
      </g>
  </svg>

yegorandrosov avatar Jun 28 '24 11:06 yegorandrosov

or this issue is related to Æsthetic?

yegorandrosov avatar Jun 28 '24 11:06 yegorandrosov

also having this issue

usamaejaz avatar Jul 20 '25 23:07 usamaejaz

I am not sure if i switched over to some other formatter or changing from <path /> to <path></path> helped

yegorandrosov avatar Jul 21 '25 10:07 yegorandrosov