trivago / prettier-plugin-twig-melody

Code formatting plugin for Prettier which can handle Twig/Melody templates
Apache License 2.0
155 stars 35 forks source link

Error: ERROR: Invalid Token (\\) #75

Open nelson6e65 opened 3 years ago

nelson6e65 commented 3 years ago

Hi. I use "\" to represent an scaped \ character, but i get this error:

[error]    9 | <a href="{{ parent_location }}.html#{{ method
[error]   10 |     |trim('\\()')
[error] > 11 |     |replace({'\\': '-'}) }}">
[error]      |                      ^
[error]   12 |   {{- text|default(method.name|default(method))|raw -}}
[error]   13 | </a>
<a href="{{ parent_location }}.html#{{ method
    |trim('\\()')
    |replace({'\\': '-'}) }}">
  {{- text|default(method.name|default(method))|raw -}}
</a>

If I remove "\", by using another string, succeeded.

nelson6e65 commented 3 years ago

It also fails if I use this alternative instead of using the replace filter: |split('\\')|join('-')