sveltejs / svelte.dev

The Svelte omnisite
https://svelte.dev
111 stars 68 forks source link

`tutorial`: buggy code snippets #467

Open manuel3108 opened 1 month ago

manuel3108 commented 1 month ago

number 1

https://svelte-omnisite.vercel.app/tutorial/svelte/html-tags image According to the code, the whole @html should be highlighted in green, but currently only the @ is highlighted. https://github.com/sveltejs/svelte.dev/blob/5df7fa7c20be840b755e1ca8262520cf81335876/apps/svelte.dev/content/tutorial/01-svelte/01-introduction/06-html-tags/index.md?plain=1#L13

number 2

https://svelte-omnisite.vercel.app/tutorial/svelte/universal-reactivity image wth?

number 3 (similar to number 1)

http://localhost:5173/tutorial/svelte/each-blocks image https://github.com/sveltejs/svelte.dev/blob/5df7fa7c20be840b755e1ca8262520cf81335876/apps/svelte.dev/content/tutorial/01-svelte/04-logic/04-each-blocks/index.md?plain=1#L32-L35

number x

There are a few more cases like number 1 and 3, but im not going to list them all here, as it's probably going to be just one fix for all of them

dummdidumm commented 1 month ago

I think the highlighting only works on tokens, and therefore is too long or cut off depending on where they start/end

Conduitry commented 1 month ago

Number 2 isn't happening for me. What device/browser are you on?

manuel3108 commented 1 month ago

Windows and Edge. Just checked, this only happens for me after loading the page, going to the previous one, and then to the original one.

Rich-Harris commented 1 month ago

When stuff gets highlighted incorrectly it's likely because the two ends of the range don't have the same parent element. there's some munging that happens to try and make it behave but it's clearly not sophisticated enough