question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prettier adds extra closing bracket when a pre tag contains elements with angular template reference variables

See original GitHub issue

Prettier 1.15.2 Playground link

--parser angular

Input:

<pre><code #foo></code></pre>

Output:

<pre><code #foo></code>></pre>

Expected behavior: Prettier should not add an extra closing angle bracket after </code>

EDIT: changed example to use <code> instead of <p>. This is how I originally found the bug, not sure why I thought it would be better to replace <code> with <p>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ikatyangcommented, Nov 14, 2018

We use snapshot testing to verify the result, see CONTRIBUTING.md for more info.

In short, you could create a temporary test file just like what @mister-walter said, and run bin/prettier.js foo.html to see if it works. If it works, put it in the tests folder and run AST_COMPARE=1 yarn test -u, it should be good to send the PR if everything worked as expected.

1reaction
michaeljotacommented, Nov 13, 2018

As a workaround you can span the code block to a new line.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
Bracket Line. Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of...
Read more >
Unexpected character "EOF" (Do you have an unescaped ...
I am upgrading my angular 2 app from beta 9 to RC5 and i get this error in my form template.
Read more >
next js blog starter github - UT Physicians Group
I have made the blog available as a starter template so feel free to fork and modify ... slash / then the element...
Read more >
WebStorm 182.2371.25 Release Notes | Knowledge Base
Bug, WEB-32412, template stringx jsx closing bracket expected ... Bug, WEB-31883, "Copy Reference" for JSON items does not include arrays indices.
Read more >
Prism
Dead simple Include prism.css and prism.js, use proper HTML5 code tags ( code.language-xxxx ), done ... Languages add 0.3-0.5KB each, themes are around...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found