Skip to content

Commit d8ece11

Browse files
committed
Fix highlight.js
1 parent 6d9b308 commit d8ece11

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/routes/+layout.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
import NavBar from '$lib/components/shared/NavBar.svelte';
77
import Footer from '$lib/components/shared/Footer.svelte';
88
import SideNav from '$lib/components/shared/SideNav.svelte';
9-
import hljs from 'highlight.js';
10-
import { onMount } from 'svelte';
9+
import hljs from 'highlight.js/lib/core';
10+
import c from 'highlight.js/lib/languages/c';
11+
import { afterNavigate } from '$app/navigation';
1112
12-
onMount(() => {
13+
let { children } = $props();
14+
15+
hljs.registerLanguage('c', c);
16+
afterNavigate(() => {
1317
hljs.highlightAll();
1418
});
1519
</script>
@@ -25,7 +29,7 @@
2529
</div>
2630
<div class="flex grow justify-center">
2731
<div class="w-full lg:w-1/2">
28-
<slot />
32+
{@render children()}
2933
</div>
3034
</div>
3135
</div>

src/routes/blog/articles/numworks-programming/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ sleep(t) - suspend execution for t seconds</code
116116
and also uses a special implementation of python called MicroPython. Digging into the
117117
MicroPython source code, we can find a base definition of an object in C:
118118
</p>
119-
<pre><code class="language-c"
119+
<pre><code
120120
>{`// Anything that wants to be a concrete MicroPython object must have mp_obj_base_t
121121
// as its first member (small ints, qstr objs and inline floats are not concrete).
122122
struct _mp_obj_base_t {
@@ -163,7 +163,7 @@ struct _mp_obj_base_t {
163163
code for the header file, pulled from my latest app at the time of writing, below.
164164
</p>
165165
<Collapsible title="eadk.h">
166-
<pre class="h-96"><code class="language-c"
166+
<pre class="h-96"><code
167167
>{`#ifndef EADK_H
168168
#define EADK_H
169169

0 commit comments

Comments
 (0)