@farming-labs/astro-theme 0.1.10 → 0.1.12
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/astro-theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Astro UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"sugar-high": "^0.9.5",
|
|
112
|
-
"@farming-labs/
|
|
113
|
-
"@farming-labs/
|
|
112
|
+
"@farming-labs/astro": "0.1.12",
|
|
113
|
+
"@farming-labs/docs": "0.1.12"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"astro": ">=4.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
|
}
|