fix: 🐛 fix code blocks rendering as "undefined" for unregistered languages

This commit is contained in:
Maxime Cannoodt 2022-08-07 13:15:26 +02:00
parent 65dd18b7cd
commit 68660543d7
2 changed files with 1034 additions and 10 deletions

1029
webapp/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,20 +13,15 @@
onMount(() => {
if (browser) {
if (hljs.getLanguage(lang) !== undefined) {
highlighted = hljs.highlight(text, { language: lang }).value;
} else {
highlighted = text;
}
}
});
</script>
<svelte:head>
<!-- <link
rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/github-dark.min.css"
/> -->
</svelte:head>
<div class="">
<!-- <pre class="language-{lang}"><code>{text}</code></pre> -->
<pre class="language-{lang}"><code>{@html highlighted}</code></pre>
</div>