@tiramisu-docs/kit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/highlight.js +5 -5
- package/package.json +1 -1
- package/src/highlight.ts +5 -5
package/dist/highlight.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createHighlighter } from "shiki";
|
|
2
2
|
import { tiramisuGrammar } from "./tiramisu-grammar.js";
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
if (!
|
|
6
|
-
|
|
3
|
+
let highlighterPromise = null;
|
|
4
|
+
function getHighlighter() {
|
|
5
|
+
if (!highlighterPromise) {
|
|
6
|
+
highlighterPromise = createHighlighter({
|
|
7
7
|
themes: ["github-light", "github-dark"],
|
|
8
8
|
langs: [
|
|
9
9
|
"typescript",
|
|
@@ -22,7 +22,7 @@ async function getHighlighter() {
|
|
|
22
22
|
],
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return highlighterPromise;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Post-process compiled Svelte output to add syntax highlighting.
|
package/package.json
CHANGED
package/src/highlight.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createHighlighter, type Highlighter } from "shiki"
|
|
2
2
|
import { tiramisuGrammar } from "./tiramisu-grammar.js"
|
|
3
3
|
|
|
4
|
-
let
|
|
4
|
+
let highlighterPromise: Promise<Highlighter> | null = null
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
if (!
|
|
8
|
-
|
|
6
|
+
function getHighlighter(): Promise<Highlighter> {
|
|
7
|
+
if (!highlighterPromise) {
|
|
8
|
+
highlighterPromise = createHighlighter({
|
|
9
9
|
themes: ["github-light", "github-dark"],
|
|
10
10
|
langs: [
|
|
11
11
|
"typescript",
|
|
@@ -24,7 +24,7 @@ async function getHighlighter(): Promise<Highlighter> {
|
|
|
24
24
|
],
|
|
25
25
|
})
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return highlighterPromise
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|