HTML comments inside svelte markup cause a distortion of the tag <script>
See original GitHub issueIf you add any html comment (for example: <!--SomeComment-->
) before the closing </ul>
tag in src/routes/blog/index.svelte
in this project, the script
tag will be distorted. Here is an example:
<svelte:head>
<title>Blog</title>
</svelte:head>
<h1>Recent posts</h1>
<ul>
{#each posts as post}
<!-- we're using the non-standard `rel=prefetch` attribute to
tell Sapper to load the data for the page as soon as
the user hovers over the link or taps it, instead of
waiting for the 'click' event -->
<li><a rel="prefetch" href="blog/{post.slug}">{post.title}</a></li>
{/each}
<!--Comment-->
</ul>
<script<svelte:head>
>
export function preload() {
return this.fetch(`blog.json`)
.then((r) => r.json())
.then((posts) => {
return { posts };
});
}
</script>
VSCode 1.50.0 Svelte for VS Code: v102.1.1 Prettier - Code formatter: v5.7.1
my settings.json:
{
"workbench.iconTheme": "material-icon-theme",
"editor.tabSize": 2,
"editor.fontFamily": "' JetBrains Mono','Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
"editor.fontSize": 14.5,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"files.watcherExclude": {
"**/build/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
},
"files.autoSave": "onFocusChange",
"html.format.indentInnerHtml": true,
"svelte.plugin.css.enable": false,
"svelte.plugin.css.diagnostics.enable": false,
"svelte.plugin.svelte.diagnostics.enable": false
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
HTML comments inside svelte markup cause formatting to fail
Describe the bug HTML comments inside svelte markup prevents remaining ... of the Sapper template project, the tag <script context="module"> is distorted:
Read more >Are HTML comments inside script tags a best practice? [closed]
Using HTML Comments In Script Is Bad // DON'T do this! Code is just representative on how things were done <script language="javascript"> <!...
Read more >Introduction / HTML tags • Svelte Tutorial
Ordinarily, strings are inserted as plain text, meaning that characters like < and > have no special meaning. But sometimes you need to...
Read more >Untitled
All in it justin bieber piano, Actiiv fitband nz, Four seasons garden center rochford, Borang kenaikan pangkat dg32 ke dg34, Monitoramento online gratis, ......
Read more >KoA - River Thames Conditions - Environment Agency - GOV.UK
#miele Golf ulzama hotel, Kranenburgweg 142 den haag, Verliefdheid weghalen, Amor platonico lyrics in english, Compendio farmacologia katzung pdf, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dummdidumm Sorry, I forgot to update the plugin. Everything works great. Thank you!
Is
prettier-plugin-svelte
part of yournode_modules
? If so, that needs to be bumped to the latest version, too. If the plugin is present in thenode_modules
that one is used instead of the one bundled with VS Code.