@farming-labs/svelte-theme 0.1.9 → 0.1.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte-theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Svelte UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"gray-matter": "^4.0.3",
|
|
114
114
|
"sugar-high": "^0.9.5",
|
|
115
|
-
"@farming-labs/docs": "0.1.
|
|
116
|
-
"@farming-labs/svelte": "0.1.
|
|
115
|
+
"@farming-labs/docs": "0.1.11",
|
|
116
|
+
"@farming-labs/svelte": "0.1.11"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"svelte": ">=5.0.0"
|
|
@@ -59,6 +59,11 @@ function renderTable(rows) {
|
|
|
59
59
|
export function renderMarkdown(text) {
|
|
60
60
|
if (!text) return "";
|
|
61
61
|
|
|
62
|
+
const codeBlockTokenBoundary = String.fromCharCode(0);
|
|
63
|
+
const codeBlockTokenPattern = new RegExp(
|
|
64
|
+
`${codeBlockTokenBoundary}CB(\\d+)${codeBlockTokenBoundary}`,
|
|
65
|
+
"g",
|
|
66
|
+
);
|
|
62
67
|
const codeBlocks = [];
|
|
63
68
|
|
|
64
69
|
// Complete fences: ```lang\n...\n```
|
|
@@ -114,7 +119,7 @@ export function renderMarkdown(text) {
|
|
|
114
119
|
.replace(/\n\n/g, '<div style="height:8px"></div>')
|
|
115
120
|
.replace(/\n/g, "<br>");
|
|
116
121
|
|
|
117
|
-
result = result.replace(
|
|
122
|
+
result = result.replace(codeBlockTokenPattern, (_m, idx) => codeBlocks[Number(idx)]);
|
|
118
123
|
|
|
119
124
|
return result;
|
|
120
125
|
}
|