@tiramisu-docs/kit 0.1.2 → 0.1.4
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/dist/seo.js +2 -1
- package/package.json +2 -2
- package/src/highlight.ts +5 -5
- package/src/seo.ts +2 -1
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/dist/seo.js
CHANGED
|
@@ -90,7 +90,8 @@ export function buildInstantOgUrl(pageUrl, options) {
|
|
|
90
90
|
return `https://instantog.com/api/og?${params.toString()}`;
|
|
91
91
|
}
|
|
92
92
|
export function buildCanonicalUrl(baseUrl, slug) {
|
|
93
|
-
|
|
93
|
+
const cleanSlug = slug.replace(/\/index$/, "");
|
|
94
|
+
return `${baseUrl.replace(/\/+$/, "")}/docs/${cleanSlug}`;
|
|
94
95
|
}
|
|
95
96
|
export function buildPageJsonLd(options) {
|
|
96
97
|
const url = buildCanonicalUrl(options.baseUrl, options.slug);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiramisu-docs/kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "src/index.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@timeleap/tiramisu": "^1.9.0",
|
|
50
|
-
"@tiramisu-docs/core": "0.1.
|
|
50
|
+
"@tiramisu-docs/core": "0.1.1",
|
|
51
51
|
"clsx": "^2.1.1",
|
|
52
52
|
"iconify-icon": "^2.3.0",
|
|
53
53
|
"minisearch": "^7.2.0",
|
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
|
/**
|
package/src/seo.ts
CHANGED
|
@@ -109,7 +109,8 @@ export function buildInstantOgUrl(pageUrl: string, options: { siteId: string; te
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
export function buildCanonicalUrl(baseUrl: string, slug: string): string {
|
|
112
|
-
|
|
112
|
+
const cleanSlug = slug.replace(/\/index$/, "")
|
|
113
|
+
return `${baseUrl.replace(/\/+$/, "")}/docs/${cleanSlug}`
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
export function buildPageJsonLd(options: {
|