Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svelte code block missing half the code #497

Closed
patak-dev opened this issue Dec 21, 2022 · 6 comments · Fixed by #954
Closed

svelte code block missing half the code #497

patak-dev opened this issue Dec 21, 2022 · 6 comments · Fixed by #954
Assignees
Labels
c: bug Something isn't working p: 2-high Fix main branch

Comments

@patak-dev
Copy link
Member

Report from https://elk.zone/m.webtoo.ls/@[email protected]/109552492580513200

@geoffrich
Copy link

To add some color around this, I wasn't expecting Svelte code to be highlighted correctly, but I was still expecting the code to be shown.

e.g. on GitHub I can wrap Svelte code in ```html and it displays the HTML parts alright:

{#each presents as present (present.id)}
	<img animate:flip src={present.src} alt="Present {present.id}" />
{/each}

@patak-dev
Copy link
Member Author

@orta should shiki render this html block as GitHub? I think we may be messing with the HTML in Elk before shiki has a chance to act to be honest

@orta
Copy link

orta commented Dec 22, 2022

This is likely fixed in the release I did over the weekend because of shikijs/shiki#379

@SarcevicAntonio
Copy link

I don't think it is shiki related, because while writing the post it looks fine.

Screenshot 2022-12-22 at 09 53 54

Only after it was published and then viewed it's broken.

Screenshot 2022-12-22 at 09 54 04

I also tried bumping shiki to 0.12.1 where the mentioned fix is included and get the same behavior.

@orta
Copy link

orta commented Dec 22, 2022

Could the markdown processor be reading the inner HTML as HTML?

@SarcevicAntonio
Copy link

I found out this isn't Svelte-specific, it seems to be all HTML Tags.

on Mastodon.online
Screenshot 2022-12-22 at 12 16 47

on Elk
Screenshot 2022-12-22 at 12 17 01

I guess that somewhere inside content-render.ts / content-parse.ts the code block HTML text gets parsed as actual HTML tags and then gets lost somehow, as it's not a text-node after parsing.
If I return input.value instead of decodingHtml inside the treeToText function I see the code but without < but &lt;.
I can't out figure it out though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working p: 2-high Fix main branch
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants