@seed-hypermedia/client 0.0.55 → 0.0.56
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/index.mjs +21 -19
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2771,7 +2771,7 @@ function tokenize(markdown) {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
if (line.trim().startsWith("```")) {
|
|
2773
2773
|
const fenceContent = line.trim().slice(3).trim();
|
|
2774
|
-
const { text: language, id } = stripBlockId(fenceContent);
|
|
2774
|
+
const { text: language, id: id2 } = stripBlockId(fenceContent);
|
|
2775
2775
|
const codeLines = [];
|
|
2776
2776
|
i++;
|
|
2777
2777
|
while (i < lines.length && !lines[i].trim().startsWith("```")) {
|
|
@@ -2779,13 +2779,13 @@ function tokenize(markdown) {
|
|
|
2779
2779
|
i++;
|
|
2780
2780
|
}
|
|
2781
2781
|
i++;
|
|
2782
|
-
blocks.push({ kind: "code", language, text: codeLines.join("\n"), id });
|
|
2782
|
+
blocks.push({ kind: "code", language, text: codeLines.join("\n"), id: id2 });
|
|
2783
2783
|
pendingContainerId = void 0;
|
|
2784
2784
|
continue;
|
|
2785
2785
|
}
|
|
2786
2786
|
if (line.trim().startsWith("$$")) {
|
|
2787
2787
|
const fenceContent = line.trim().slice(2).trim();
|
|
2788
|
-
const { id } = stripBlockId(fenceContent);
|
|
2788
|
+
const { id: id2 } = stripBlockId(fenceContent);
|
|
2789
2789
|
const mathLines = [];
|
|
2790
2790
|
i++;
|
|
2791
2791
|
while (i < lines.length && !lines[i].trim().startsWith("$$")) {
|
|
@@ -2793,14 +2793,14 @@ function tokenize(markdown) {
|
|
|
2793
2793
|
i++;
|
|
2794
2794
|
}
|
|
2795
2795
|
i++;
|
|
2796
|
-
blocks.push({ kind: "math", text: mathLines.join("\n"), id });
|
|
2796
|
+
blocks.push({ kind: "math", text: mathLines.join("\n"), id: id2 });
|
|
2797
2797
|
pendingContainerId = void 0;
|
|
2798
2798
|
continue;
|
|
2799
2799
|
}
|
|
2800
|
-
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
2800
|
+
const headingMatch = line.trim().match(/^(#{1,6})\s+(.+)$/);
|
|
2801
2801
|
if (headingMatch) {
|
|
2802
|
-
const { text, id } = stripBlockId(headingMatch[2]);
|
|
2803
|
-
blocks.push({ kind: "heading", level: headingMatch[1].length, text, id });
|
|
2802
|
+
const { text, id: id2 } = stripBlockId(headingMatch[2]);
|
|
2803
|
+
blocks.push({ kind: "heading", level: headingMatch[1].length, text, id: id2 });
|
|
2804
2804
|
i++;
|
|
2805
2805
|
pendingContainerId = void 0;
|
|
2806
2806
|
continue;
|
|
@@ -2809,11 +2809,11 @@ function tokenize(markdown) {
|
|
|
2809
2809
|
if (imageMatch) {
|
|
2810
2810
|
let url = imageMatch[2];
|
|
2811
2811
|
const trailing = imageMatch[3] || "";
|
|
2812
|
-
const { id } = stripBlockId(trailing);
|
|
2812
|
+
const { id: id2 } = stripBlockId(trailing);
|
|
2813
2813
|
if (url && !url.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//)) {
|
|
2814
2814
|
url = `file://${url}`;
|
|
2815
2815
|
}
|
|
2816
|
-
blocks.push({ kind: "image", alt: imageMatch[1], url, id });
|
|
2816
|
+
blocks.push({ kind: "image", alt: imageMatch[1], url, id: id2 });
|
|
2817
2817
|
i++;
|
|
2818
2818
|
pendingContainerId = void 0;
|
|
2819
2819
|
continue;
|
|
@@ -2832,8 +2832,8 @@ function tokenize(markdown) {
|
|
|
2832
2832
|
const items = [];
|
|
2833
2833
|
while (i < lines.length && /^[-*+]\s+/.test(lines[i].trim())) {
|
|
2834
2834
|
const raw = lines[i].trim().replace(/^[-*+]\s+/, "");
|
|
2835
|
-
const { text, id } = stripBlockId(raw);
|
|
2836
|
-
items.push({ text, id });
|
|
2835
|
+
const { text, id: id2 } = stripBlockId(raw);
|
|
2836
|
+
items.push({ text, id: id2 });
|
|
2837
2837
|
i++;
|
|
2838
2838
|
}
|
|
2839
2839
|
blocks.push({ kind: "ul", items, containerId: pendingContainerId });
|
|
@@ -2844,8 +2844,8 @@ function tokenize(markdown) {
|
|
|
2844
2844
|
const items = [];
|
|
2845
2845
|
while (i < lines.length && /^\d+\.\s+/.test(lines[i].trim())) {
|
|
2846
2846
|
const raw = lines[i].trim().replace(/^\d+\.\s+/, "");
|
|
2847
|
-
const { text, id } = stripBlockId(raw);
|
|
2848
|
-
items.push({ text, id });
|
|
2847
|
+
const { text, id: id2 } = stripBlockId(raw);
|
|
2848
|
+
items.push({ text, id: id2 });
|
|
2849
2849
|
i++;
|
|
2850
2850
|
}
|
|
2851
2851
|
blocks.push({ kind: "ol", items, containerId: pendingContainerId });
|
|
@@ -2857,13 +2857,15 @@ function tokenize(markdown) {
|
|
|
2857
2857
|
paraLines.push(lines[i]);
|
|
2858
2858
|
i++;
|
|
2859
2859
|
}
|
|
2860
|
-
if (paraLines.length
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
paraLines[0] = cleanFirst;
|
|
2864
|
-
blocks.push({ kind: "paragraph", text: paraLines.join("\n"), id });
|
|
2865
|
-
pendingContainerId = void 0;
|
|
2860
|
+
if (paraLines.length === 0) {
|
|
2861
|
+
paraLines.push(line);
|
|
2862
|
+
i++;
|
|
2866
2863
|
}
|
|
2864
|
+
const firstLine = paraLines[0];
|
|
2865
|
+
const { text: cleanFirst, id } = stripBlockId(firstLine);
|
|
2866
|
+
paraLines[0] = cleanFirst;
|
|
2867
|
+
blocks.push({ kind: "paragraph", text: paraLines.join("\n"), id });
|
|
2868
|
+
pendingContainerId = void 0;
|
|
2867
2869
|
}
|
|
2868
2870
|
return blocks;
|
|
2869
2871
|
}
|