@monimesl/dot-renderer-react 0.1.0-alpha.35 → 0.1.0-alpha.36
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/markdown.js +14 -14
- package/package.json +4 -4
package/dist/markdown.js
CHANGED
|
@@ -129,7 +129,7 @@ function parseInline(text) {
|
|
|
129
129
|
text
|
|
130
130
|
}];
|
|
131
131
|
const inlines = [];
|
|
132
|
-
const
|
|
132
|
+
const closingSearches = /* @__PURE__ */ new Map();
|
|
133
133
|
let plain = "";
|
|
134
134
|
let index = 0;
|
|
135
135
|
const flush = () => {
|
|
@@ -196,7 +196,7 @@ function parseInline(text) {
|
|
|
196
196
|
continue;
|
|
197
197
|
}
|
|
198
198
|
if (char === "*" || char === "_") {
|
|
199
|
-
const strong = between(text, index, char + char,
|
|
199
|
+
const strong = between(text, index, char + char, closingSearches);
|
|
200
200
|
if (strong) {
|
|
201
201
|
take({
|
|
202
202
|
kind: "strong",
|
|
@@ -204,7 +204,7 @@ function parseInline(text) {
|
|
|
204
204
|
}, strong.length);
|
|
205
205
|
continue;
|
|
206
206
|
}
|
|
207
|
-
const emphasis = between(text, index, char,
|
|
207
|
+
const emphasis = between(text, index, char, closingSearches);
|
|
208
208
|
if (emphasis) {
|
|
209
209
|
take({
|
|
210
210
|
kind: "emphasis",
|
|
@@ -219,32 +219,32 @@ function parseInline(text) {
|
|
|
219
219
|
flush();
|
|
220
220
|
return inlines;
|
|
221
221
|
}
|
|
222
|
-
function between(text, start, delimiter,
|
|
222
|
+
function between(text, start, delimiter, closingSearches) {
|
|
223
223
|
const open = start + delimiter.length;
|
|
224
224
|
if (!text.startsWith(delimiter, start) || open >= text.length || /\s/.test(text[open])) return null;
|
|
225
225
|
const underscore = delimiter.startsWith("_");
|
|
226
226
|
if (underscore && /\w/.test(text[start - 1] ?? "")) return null;
|
|
227
|
-
let
|
|
228
|
-
if (!
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
let searchEnds = closingSearches.get(delimiter);
|
|
228
|
+
if (!searchEnds) {
|
|
229
|
+
searchEnds = /* @__PURE__ */ new Map();
|
|
230
|
+
closingSearches.set(delimiter, searchEnds);
|
|
231
231
|
}
|
|
232
|
-
const
|
|
232
|
+
const placesLookedAt = [];
|
|
233
233
|
let close = text.indexOf(delimiter, open + 1);
|
|
234
234
|
while (close !== -1) {
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
close =
|
|
235
|
+
const earlierEnd = searchEnds.get(close);
|
|
236
|
+
if (earlierEnd !== void 0) {
|
|
237
|
+
close = earlierEnd;
|
|
238
238
|
break;
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
placesLookedAt.push(close);
|
|
241
241
|
const touchesSpace = /\s/.test(text[close - 1]);
|
|
242
242
|
const insideWord = underscore && /\w/.test(text[close + delimiter.length] ?? "");
|
|
243
243
|
const startsPair = delimiter.length === 1 && text[close + 1] === delimiter;
|
|
244
244
|
if (!touchesSpace && !insideWord && !startsPair) break;
|
|
245
245
|
close = text.indexOf(delimiter, close + (startsPair ? 2 : 1));
|
|
246
246
|
}
|
|
247
|
-
for (const place of
|
|
247
|
+
for (const place of placesLookedAt) searchEnds.set(place, close);
|
|
248
248
|
if (close === -1) return null;
|
|
249
249
|
return {
|
|
250
250
|
inner: text.slice(open, close),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monimesl/dot-renderer-react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.36",
|
|
4
4
|
"description": "React renderer for Dot webviews",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"react": "19.3.0",
|
|
30
30
|
"react-dom": "19.3.0",
|
|
31
31
|
"uqr": "^0.1.3",
|
|
32
|
-
"@monimesl/dot-core": "0.1.0-alpha.
|
|
33
|
-
"@monimesl/dot-webview": "0.1.0-alpha.
|
|
32
|
+
"@monimesl/dot-core": "0.1.0-alpha.36",
|
|
33
|
+
"@monimesl/dot-webview": "0.1.0-alpha.36"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@base-ui/react": "1.8.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tsdown": "^0.23.0",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
48
|
"vitest": "^5.0.1",
|
|
49
|
-
"@monimesl/dot-service": "0.1.0-alpha.
|
|
49
|
+
"@monimesl/dot-service": "0.1.0-alpha.36"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|