bearminion 1.7.0 → 1.9.0
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/CHANGELOG.md +20 -0
- package/dist/astro.d.ts +2 -2
- package/dist/astro.js +17 -5
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +819 -0
- package/dist/content.d.ts +1 -1
- package/dist/content.js +2 -2
- package/dist/hash-BeBymBO1.js +59 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/marks-DPBilumg.js +174 -0
- package/dist/marks.js +1 -174
- package/dist/{options-BeJQnsZM.d.ts → options-4HWVEj9O.d.ts} +7 -1
- package/dist/{page-BfI9cD8g.d.ts → page-CA4iyFDS.d.ts} +7 -7
- package/dist/{page-NOFVEqn1.js → page-X-WnOu7-.js} +1 -1
- package/dist/{preview--S1QUrMM.js → preview-B_88I5Jm.js} +1 -1
- package/dist/{reload-BPkPoQ-P.js → reload-Dkp3xC0l.js} +1 -1
- package/dist/rich-text-70hddxMC.js +403 -0
- package/dist/rich-text.js +1 -403
- package/dist/sections-manifest-CO9QfJPG.js +97 -0
- package/dist/{theme-DFjHjgFO.js → theme-Dv7_7B56.js} +2 -2
- package/dist/ui/mount.js +20 -7
- package/package.json +7 -1
- package/registry/default/files/src/components/atoms/Button.astro +64 -0
- package/registry/default/files/src/components/atoms/Emphasis.astro +24 -0
- package/registry/default/files/src/components/atoms/Image.astro +78 -0
- package/registry/default/files/src/components/atoms/Typography.astro +53 -0
- package/registry/default/files/src/components/atoms/button.ts +31 -0
- package/registry/default/files/src/components/atoms/image.ts +34 -0
- package/registry/default/files/src/components/atoms/options.ts +39 -0
- package/registry/default/files/src/components/atoms/typography.ts +64 -0
- package/registry/default/files/src/components/molecules/CommandLine.astro +109 -0
- package/registry/default/files/src/components/molecules/MediaFrame.astro +71 -0
- package/registry/default/files/src/components/molecules/Pill.astro +24 -0
- package/registry/default/files/src/components/molecules/SectionHeader.astro +63 -0
- package/registry/default/files/src/components/molecules/SectionShell.astro +33 -0
- package/registry/default/files/src/components/sections/contact/Contact.astro +231 -0
- package/registry/default/files/src/components/sections/contact/definition.ts +52 -0
- package/registry/default/files/src/components/sections/contact/form.ts +313 -0
- package/registry/default/files/src/components/sections/contact/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/cta/Cta.astro +206 -0
- package/registry/default/files/src/components/sections/cta/definition.ts +49 -0
- package/registry/default/files/src/components/sections/cta/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/faq/Faq.astro +136 -0
- package/registry/default/files/src/components/sections/faq/definition.ts +54 -0
- package/registry/default/files/src/components/sections/faq/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/features/Features.astro +146 -0
- package/registry/default/files/src/components/sections/features/definition.ts +54 -0
- package/registry/default/files/src/components/sections/features/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/gallery/Gallery.astro +128 -0
- package/registry/default/files/src/components/sections/gallery/definition.ts +59 -0
- package/registry/default/files/src/components/sections/gallery/lightbox.ts +159 -0
- package/registry/default/files/src/components/sections/gallery/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/hero/Hero.astro +185 -0
- package/registry/default/files/src/components/sections/hero/HeroBadge.astro +26 -0
- package/registry/default/files/src/components/sections/hero/definition.ts +74 -0
- package/registry/default/files/src/components/sections/hero/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/logo-strip/LogoStrip.astro +107 -0
- package/registry/default/files/src/components/sections/logo-strip/definition.ts +30 -0
- package/registry/default/files/src/components/sections/logo-strip/wireframe.ts +11 -0
- package/registry/default/files/src/components/sections/media/Media.astro +118 -0
- package/registry/default/files/src/components/sections/media/MediaPlayer.astro +176 -0
- package/registry/default/files/src/components/sections/media/definition.ts +77 -0
- package/registry/default/files/src/components/sections/media/source.ts +3 -0
- package/registry/default/files/src/components/sections/media/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/pricing/Pricing.astro +210 -0
- package/registry/default/files/src/components/sections/pricing/definition.ts +62 -0
- package/registry/default/files/src/components/sections/pricing/wireframe.ts +18 -0
- package/registry/default/files/src/components/sections/shared.ts +13 -0
- package/registry/default/files/src/components/sections/stats/Stats.astro +110 -0
- package/registry/default/files/src/components/sections/stats/definition.ts +41 -0
- package/registry/default/files/src/components/sections/stats/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/steps/Steps.astro +139 -0
- package/registry/default/files/src/components/sections/steps/definition.ts +62 -0
- package/registry/default/files/src/components/sections/steps/icons.ts +27 -0
- package/registry/default/files/src/components/sections/steps/wireframe.ts +16 -0
- package/registry/default/files/src/components/sections/testimonials/Testimonials.astro +172 -0
- package/registry/default/files/src/components/sections/testimonials/definition.ts +42 -0
- package/registry/default/files/src/components/sections/testimonials/wireframe.ts +21 -0
- package/registry/default/files/src/components/sections/text/Text.astro +43 -0
- package/registry/default/files/src/components/sections/text/definition.ts +36 -0
- package/registry/default/files/src/components/sections/text/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/text-image/TextImage.astro +107 -0
- package/registry/default/files/src/components/sections/text-image/definition.ts +39 -0
- package/registry/default/files/src/components/sections/text-image/wireframe.ts +12 -0
- package/registry/default/files/src/lib/assets.ts +13 -0
- package/registry/default/files/src/lib/cn.ts +6 -0
- package/registry/default/files/src/lib/contact-form.ts +97 -0
- package/registry/default/files/src/lib/hidden-text.ts +32 -0
- package/registry/default/files/src/lib/image-url.ts +38 -0
- package/registry/default/files/src/lib/link-attrs.ts +74 -0
- package/registry/default/registry.json +670 -0
package/dist/rich-text.js
CHANGED
|
@@ -1,403 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const HEADING_LINE = /^(#{2,3})[ \t]+(\S.*)$/;
|
|
3
|
-
const BLOCKED_PROTOCOL = /^(?:javascript|data|vbscript):/i;
|
|
4
|
-
function renderRichText(markdown, options = {}) {
|
|
5
|
-
const headings = options.headings === true;
|
|
6
|
-
const text = markdown.replace(/\r\n/g, "\n");
|
|
7
|
-
return (headings ? text.split("\n").map((line) => HEADING_LINE.test(line.trim()) ? `\n\n${line.trim()}\n\n` : line).join("\n") : text).split(/\n{2,}/).filter((block) => block.trim() !== "").map((block) => {
|
|
8
|
-
const heading = headings ? HEADING_LINE.exec(block.trim()) : null;
|
|
9
|
-
if (heading) {
|
|
10
|
-
const tag = heading[1]?.length === 2 ? "h2" : "h3";
|
|
11
|
-
return `<${tag}>${renderInline((heading[2] ?? "").trim())}</${tag}>`;
|
|
12
|
-
}
|
|
13
|
-
const html = renderBlock(block);
|
|
14
|
-
return isListHtml(html) ? html : `<p>${html}</p>`;
|
|
15
|
-
}).join("");
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Pasted HTML, reduced to what a rich field can hold. The HTML is parsed (never inserted), read back as the
|
|
19
|
-
* markdown subset, and rendered again, so only the renderer's own tags survive: no attributes, handlers or
|
|
20
|
-
* elements from the clipboard reach the page. Headings and images are dropped. Browser only.
|
|
21
|
-
*/
|
|
22
|
-
function sanitizeRichHtml(html, options = {}) {
|
|
23
|
-
return renderRichText(markdownFromHtml(html, options), options);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Drop markdown images from pasted plain text, and headings too unless the field allows them. Then a heading of any
|
|
27
|
-
* level becomes the nearest one the field has: `#` is `##`, and `####` and deeper are `###`.
|
|
28
|
-
*/
|
|
29
|
-
function stripPlainRich(text, options = {}) {
|
|
30
|
-
const withoutImages = text.replace(/!\[[^\]]*\]\([^)\n]*\)/g, "");
|
|
31
|
-
if (options.headings !== true) return withoutImages.replace(/^#{1,6}[ \t]+.*$/gm, "");
|
|
32
|
-
return withoutImages.replace(/^#{4,6}([ \t]+)/gm, "###$1").replace(/^#([ \t]+)/gm, "##$1");
|
|
33
|
-
}
|
|
34
|
-
function renderBlock(block) {
|
|
35
|
-
const lines = block.split("\n");
|
|
36
|
-
const items = lines.map((line) => parseListItem(line.trim()));
|
|
37
|
-
const filled = lines.every((line) => line.trim() !== "");
|
|
38
|
-
if (filled && items.length > 0 && items.every((item) => item?.kind === "ul")) return `<ul>${items.map((item) => `<li>${renderInline(item?.text ?? "")}</li>`).join("")}</ul>`;
|
|
39
|
-
if (filled && items.length > 0 && items.every((item) => item?.kind === "ol")) return `<ol>${items.map((item) => `<li>${renderInline(item?.text ?? "")}</li>`).join("")}</ol>`;
|
|
40
|
-
return lines.map((line) => renderInline(line)).join("<br>");
|
|
41
|
-
}
|
|
42
|
-
function parseListItem(line) {
|
|
43
|
-
const bullet = /^[-*]\s+(.*)$/.exec(line);
|
|
44
|
-
if (bullet) return {
|
|
45
|
-
kind: "ul",
|
|
46
|
-
text: bullet[1] ?? ""
|
|
47
|
-
};
|
|
48
|
-
const ordered = /^\d+\.\s+(.*)$/.exec(line);
|
|
49
|
-
if (ordered) return {
|
|
50
|
-
kind: "ol",
|
|
51
|
-
text: ordered[1] ?? ""
|
|
52
|
-
};
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
function isListHtml(html) {
|
|
56
|
-
return html.startsWith("<ul") || html.startsWith("<ol");
|
|
57
|
-
}
|
|
58
|
-
/** True when a link URL is safe to put in an href. */
|
|
59
|
-
function isSafeHref(url) {
|
|
60
|
-
return classifyHref(url) !== null;
|
|
61
|
-
}
|
|
62
|
-
function renderInline(source) {
|
|
63
|
-
let index = 0;
|
|
64
|
-
let html = "";
|
|
65
|
-
while (index < source.length) {
|
|
66
|
-
if (source[index] === "`") {
|
|
67
|
-
const end = source.indexOf("`", index + 1);
|
|
68
|
-
if (end > index + 1) {
|
|
69
|
-
html += `<code>${escapeHtml(source.slice(index + 1, end))}</code>`;
|
|
70
|
-
index = end + 1;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (source.startsWith("***", index)) {
|
|
75
|
-
const end = source.indexOf("***", index + 3);
|
|
76
|
-
if (end !== -1) {
|
|
77
|
-
html += `<strong><em>${escapeHtml(source.slice(index + 3, end))}</em></strong>`;
|
|
78
|
-
index = end + 3;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (source.startsWith("**", index)) {
|
|
83
|
-
const end = source.indexOf("**", index + 2);
|
|
84
|
-
if (end !== -1) {
|
|
85
|
-
html += `<strong>${renderInline(source.slice(index + 2, end))}</strong>`;
|
|
86
|
-
index = end + 2;
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (source[index] === "*" && source[index + 1] !== "*") {
|
|
91
|
-
const end = source.indexOf("*", index + 1);
|
|
92
|
-
if (end !== -1 && source[end + 1] !== "*") {
|
|
93
|
-
html += `<em>${renderInline(source.slice(index + 1, end))}</em>`;
|
|
94
|
-
index = end + 1;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (source[index] === "[") {
|
|
99
|
-
const link = readLink(source, index);
|
|
100
|
-
if (link) {
|
|
101
|
-
html += link.html;
|
|
102
|
-
index = link.end;
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
html += escapeHtml(source[index] ?? "");
|
|
107
|
-
index += 1;
|
|
108
|
-
}
|
|
109
|
-
return html;
|
|
110
|
-
}
|
|
111
|
-
function readLink(source, start) {
|
|
112
|
-
const labelEnd = source.indexOf("]", start + 1);
|
|
113
|
-
if (labelEnd === -1 || source[labelEnd + 1] !== "(") return null;
|
|
114
|
-
let depth = 1;
|
|
115
|
-
let cursor = labelEnd + 2;
|
|
116
|
-
while (cursor < source.length && depth > 0) {
|
|
117
|
-
const char = source[cursor];
|
|
118
|
-
if (char === "(") depth += 1;
|
|
119
|
-
else if (char === ")") depth -= 1;
|
|
120
|
-
cursor += 1;
|
|
121
|
-
}
|
|
122
|
-
if (depth !== 0) return null;
|
|
123
|
-
const urlEnd = cursor - 1;
|
|
124
|
-
const label = renderInline(source.slice(start + 1, labelEnd));
|
|
125
|
-
const href = classifyHref(source.slice(labelEnd + 2, urlEnd));
|
|
126
|
-
let end = urlEnd + 1;
|
|
127
|
-
let flag;
|
|
128
|
-
if (source.startsWith("{new}", end)) {
|
|
129
|
-
flag = "new";
|
|
130
|
-
end += 5;
|
|
131
|
-
} else if (source.startsWith("{same}", end)) {
|
|
132
|
-
flag = "same";
|
|
133
|
-
end += 6;
|
|
134
|
-
}
|
|
135
|
-
if (!href) return {
|
|
136
|
-
html: label,
|
|
137
|
-
end
|
|
138
|
-
};
|
|
139
|
-
const blank = flag === "new" || flag !== "same" && href.external;
|
|
140
|
-
const mode = flag === "new" ? " data-new-tab=\"true\"" : flag === "same" ? " data-new-tab=\"false\"" : "";
|
|
141
|
-
const extra = blank ? " target=\"_blank\" rel=\"noopener noreferrer\"" : "";
|
|
142
|
-
return {
|
|
143
|
-
html: `<a href="${escapeAttr(href.url)}"${mode}${extra}>${label}</a>`,
|
|
144
|
-
end
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function classifyHref(url) {
|
|
148
|
-
if (url === "" || /[\s"'<>`]/.test(url) || /[\u0000-\u001f]/.test(url)) return null;
|
|
149
|
-
if (BLOCKED_PROTOCOL.test(url.trim())) return null;
|
|
150
|
-
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !/^(?:https?|mailto|tel):/i.test(url)) return null;
|
|
151
|
-
return {
|
|
152
|
-
url,
|
|
153
|
-
external: /^https?:\/\//i.test(url)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function escapeHtml(value) {
|
|
157
|
-
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """);
|
|
158
|
-
}
|
|
159
|
-
function escapeAttr(value) {
|
|
160
|
-
return escapeHtml(value);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Turn the formatted DOM of a rich field back into the stored markdown subset. The HTML is parsed with
|
|
164
|
-
* `DOMParser`, which never runs scripts or loads resources. Browser only (the editor overlay).
|
|
165
|
-
*/
|
|
166
|
-
function markdownFromHtml(html, options = {}) {
|
|
167
|
-
return cleanup(serialize(parseHtml(html, options.headings === true)));
|
|
168
|
-
}
|
|
169
|
-
/** Elements whose content is dropped with them. */
|
|
170
|
-
const DROPPED = /* @__PURE__ */ new Set([
|
|
171
|
-
"script",
|
|
172
|
-
"style",
|
|
173
|
-
"template",
|
|
174
|
-
"noscript",
|
|
175
|
-
"iframe",
|
|
176
|
-
"object",
|
|
177
|
-
"svg",
|
|
178
|
-
"math",
|
|
179
|
-
"img",
|
|
180
|
-
"picture",
|
|
181
|
-
"video",
|
|
182
|
-
"audio"
|
|
183
|
-
]);
|
|
184
|
-
/** Headings a field without them drops, with their text. */
|
|
185
|
-
const HEADING_TAGS = /* @__PURE__ */ new Set([
|
|
186
|
-
"h1",
|
|
187
|
-
"h2",
|
|
188
|
-
"h3",
|
|
189
|
-
"h4",
|
|
190
|
-
"h5",
|
|
191
|
-
"h6"
|
|
192
|
-
]);
|
|
193
|
-
function parseHtml(html, headings) {
|
|
194
|
-
const root = {
|
|
195
|
-
mark: "root",
|
|
196
|
-
children: []
|
|
197
|
-
};
|
|
198
|
-
const body = new DOMParser().parseFromString(`<!doctype html><body>${html}`, "text/html").body;
|
|
199
|
-
appendChildren(body, root, headings);
|
|
200
|
-
return root;
|
|
201
|
-
}
|
|
202
|
-
function appendChildren(parent, into, headings) {
|
|
203
|
-
for (const child of Array.from(parent.childNodes)) {
|
|
204
|
-
if (child.nodeType === TEXT_NODE) {
|
|
205
|
-
into.children.push({
|
|
206
|
-
mark: "text",
|
|
207
|
-
text: child.nodeValue ?? "",
|
|
208
|
-
children: []
|
|
209
|
-
});
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (child.nodeType !== ELEMENT_NODE) continue;
|
|
213
|
-
const element = child;
|
|
214
|
-
const name = element.tagName.toLowerCase();
|
|
215
|
-
if (DROPPED.has(name)) continue;
|
|
216
|
-
if (HEADING_TAGS.has(name) && !headings) continue;
|
|
217
|
-
if (name === "br") {
|
|
218
|
-
into.children.push({
|
|
219
|
-
mark: "text",
|
|
220
|
-
text: "\n",
|
|
221
|
-
children: []
|
|
222
|
-
});
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
const mark = blockOf(name) ?? markOf(name, element.getAttribute("style") ?? "");
|
|
226
|
-
if (!mark) {
|
|
227
|
-
appendChildren(element, into, headings);
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
const tab = mark === "link" ? element.getAttribute("data-new-tab") : null;
|
|
231
|
-
const node = {
|
|
232
|
-
mark,
|
|
233
|
-
children: [],
|
|
234
|
-
href: mark === "link" ? element.getAttribute("href") ?? "" : void 0,
|
|
235
|
-
newTab: tab === "true" ? "new" : tab === "false" ? "same" : void 0
|
|
236
|
-
};
|
|
237
|
-
into.children.push(node);
|
|
238
|
-
appendChildren(element, node, headings);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const ELEMENT_NODE = 1;
|
|
242
|
-
const TEXT_NODE = 3;
|
|
243
|
-
function blockOf(name) {
|
|
244
|
-
if (name === "h1" || name === "h2") return "h2";
|
|
245
|
-
if (name === "h3" || name === "h4" || name === "h5" || name === "h6") return "h3";
|
|
246
|
-
if (name === "ul") return "ul";
|
|
247
|
-
if (name === "ol") return "ol";
|
|
248
|
-
if (name === "li") return "li";
|
|
249
|
-
if (name === "p" || name === "div" || name === "blockquote") return "block";
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
function markOf(name, style) {
|
|
253
|
-
if (name === "strong" || name === "b") return "strong";
|
|
254
|
-
if (name === "em" || name === "i") return "em";
|
|
255
|
-
if (name === "code" || name === "kbd" || name === "samp") return "code";
|
|
256
|
-
if (name === "a") return "link";
|
|
257
|
-
if (name === "span") {
|
|
258
|
-
if (/font-weight\s*:\s*(?:bold|[7-9]00)/i.test(style)) return "strong";
|
|
259
|
-
if (/font-style\s*:\s*italic/i.test(style)) return "em";
|
|
260
|
-
}
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
function serialize(node) {
|
|
264
|
-
if (node.mark === "root") return serializeFlow(node.children);
|
|
265
|
-
return serializeInline(node);
|
|
266
|
-
}
|
|
267
|
-
function serializeFlow(nodes) {
|
|
268
|
-
let out = "";
|
|
269
|
-
for (const node of nodes) {
|
|
270
|
-
if (node.mark === "ul" || node.mark === "ol") {
|
|
271
|
-
const list = serializeList(node);
|
|
272
|
-
if (list === "") continue;
|
|
273
|
-
if (out.trim() !== "" && !out.endsWith("\n\n")) out = out.replace(/\n*$/, "\n\n");
|
|
274
|
-
out += `${list}\n\n`;
|
|
275
|
-
continue;
|
|
276
|
-
}
|
|
277
|
-
if (node.mark === "h2" || node.mark === "h3") {
|
|
278
|
-
const text = node.children.map((child) => serializeInline(child)).join("").replace(/\s*\n+\s*/g, " ").trim();
|
|
279
|
-
if (text === "") continue;
|
|
280
|
-
if (out.trim() !== "" && !out.endsWith("\n\n")) out = out.replace(/\n*$/, "\n\n");
|
|
281
|
-
out += `${node.mark === "h2" ? "##" : "###"} ${text}\n\n`;
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
if (node.mark === "block") {
|
|
285
|
-
const inner = serializeFlow(node.children).replace(/\n+$/, "");
|
|
286
|
-
if (inner === "") continue;
|
|
287
|
-
if (out.trim() !== "" && !out.endsWith("\n\n")) out = out.replace(/\n*$/, "\n\n");
|
|
288
|
-
out += `${inner}\n\n`;
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
out += serializeInline(node);
|
|
292
|
-
}
|
|
293
|
-
return out;
|
|
294
|
-
}
|
|
295
|
-
function serializeList(node) {
|
|
296
|
-
return node.children.filter((child) => child.mark === "li").map((item, index) => {
|
|
297
|
-
const text = listItemText(item).replace(/\n+/g, " ").trim();
|
|
298
|
-
return node.mark === "ol" ? `${index + 1}. ${text}` : `- ${text}`;
|
|
299
|
-
}).join("\n");
|
|
300
|
-
}
|
|
301
|
-
function listItemText(node) {
|
|
302
|
-
return node.children.map((child) => {
|
|
303
|
-
if (child.mark === "ul" || child.mark === "ol") return serializeList(child);
|
|
304
|
-
if (child.mark === "block") return serializeFlow(child.children);
|
|
305
|
-
return serializeInline(child);
|
|
306
|
-
}).join("");
|
|
307
|
-
}
|
|
308
|
-
function serializeInline(node) {
|
|
309
|
-
if (node.mark === "text") return node.text ?? "";
|
|
310
|
-
if (node.mark === "code") {
|
|
311
|
-
const text = plainText(node).replace(/`/g, "").replace(/\n+/g, " ");
|
|
312
|
-
return text.trim() === "" ? text : `\`${text}\``;
|
|
313
|
-
}
|
|
314
|
-
if (node.mark === "ul" || node.mark === "ol") return serializeList(node);
|
|
315
|
-
if (node.mark === "li" || node.mark === "block" || node.mark === "root" || node.mark === "h2" || node.mark === "h3") return serializeFlow(node.mark === "h2" || node.mark === "h3" ? [node] : node.children);
|
|
316
|
-
const inner = node.children.map((child) => serializeInline(child)).join("");
|
|
317
|
-
if (!inner) return "";
|
|
318
|
-
if (node.mark === "strong") return `**${inner}**`;
|
|
319
|
-
if (node.mark === "em") return `*${inner}*`;
|
|
320
|
-
if (node.mark === "link") {
|
|
321
|
-
const href = node.href ?? "";
|
|
322
|
-
if (!isSafeHref(href)) return inner;
|
|
323
|
-
return `[${inner}](${href})${node.newTab === "new" ? "{new}" : node.newTab === "same" ? "{same}" : ""}`;
|
|
324
|
-
}
|
|
325
|
-
return inner;
|
|
326
|
-
}
|
|
327
|
-
function plainText(node) {
|
|
328
|
-
if (node.mark === "text") return node.text ?? "";
|
|
329
|
-
return node.children.map((child) => plainText(child)).join("");
|
|
330
|
-
}
|
|
331
|
-
function cleanup(value) {
|
|
332
|
-
return value.replace(/\u00a0/g, " ").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
333
|
-
}
|
|
334
|
-
/** The nth markdown link, in source order. */
|
|
335
|
-
function richLinkAt(markdown, index) {
|
|
336
|
-
return listRichLinks(markdown)[index] ?? null;
|
|
337
|
-
}
|
|
338
|
-
/** Replace the nth markdown link. The label stays plain text. */
|
|
339
|
-
function updateRichLink(markdown, index, next) {
|
|
340
|
-
const span = locateRichLinks(markdown)[index];
|
|
341
|
-
if (!span || !isSafeHref(next.href)) return markdown;
|
|
342
|
-
const label = next.label.replace(/[[\]]/g, "");
|
|
343
|
-
const external = /^https?:\/\//i.test(next.href);
|
|
344
|
-
const flag = next.newTab ? "{new}" : external ? "{same}" : "";
|
|
345
|
-
return `${markdown.slice(0, span.start)}[${label}](${next.href})${flag}${markdown.slice(span.end)}`;
|
|
346
|
-
}
|
|
347
|
-
function listRichLinks(markdown) {
|
|
348
|
-
return locateRichLinks(markdown).map((span) => ({
|
|
349
|
-
label: span.label,
|
|
350
|
-
href: span.href,
|
|
351
|
-
newTab: span.flag === "new" || span.flag !== "same" && /^https?:\/\//i.test(span.href)
|
|
352
|
-
}));
|
|
353
|
-
}
|
|
354
|
-
function locateRichLinks(source) {
|
|
355
|
-
const found = [];
|
|
356
|
-
let index = 0;
|
|
357
|
-
while (index < source.length) {
|
|
358
|
-
if (source[index] === "[") {
|
|
359
|
-
const span = readLinkSpan(source, index);
|
|
360
|
-
if (span) {
|
|
361
|
-
found.push(span);
|
|
362
|
-
index = span.end;
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
index += 1;
|
|
367
|
-
}
|
|
368
|
-
return found;
|
|
369
|
-
}
|
|
370
|
-
function readLinkSpan(source, start) {
|
|
371
|
-
const labelEnd = source.indexOf("]", start + 1);
|
|
372
|
-
if (labelEnd === -1 || source[labelEnd + 1] !== "(") return null;
|
|
373
|
-
let depth = 1;
|
|
374
|
-
let cursor = labelEnd + 2;
|
|
375
|
-
while (cursor < source.length && depth > 0) {
|
|
376
|
-
const char = source[cursor];
|
|
377
|
-
if (char === "(") depth += 1;
|
|
378
|
-
else if (char === ")") depth -= 1;
|
|
379
|
-
cursor += 1;
|
|
380
|
-
}
|
|
381
|
-
if (depth !== 0) return null;
|
|
382
|
-
const urlEnd = cursor - 1;
|
|
383
|
-
const href = source.slice(labelEnd + 2, urlEnd);
|
|
384
|
-
if (!isSafeHref(href)) return null;
|
|
385
|
-
let end = urlEnd + 1;
|
|
386
|
-
let flag;
|
|
387
|
-
if (source.startsWith("{new}", end)) {
|
|
388
|
-
flag = "new";
|
|
389
|
-
end += 5;
|
|
390
|
-
} else if (source.startsWith("{same}", end)) {
|
|
391
|
-
flag = "same";
|
|
392
|
-
end += 6;
|
|
393
|
-
}
|
|
394
|
-
return {
|
|
395
|
-
start,
|
|
396
|
-
end,
|
|
397
|
-
label: source.slice(start + 1, labelEnd),
|
|
398
|
-
href,
|
|
399
|
-
flag
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
//#endregion
|
|
403
|
-
export { escapeHtml, isSafeHref, markdownFromHtml, renderRichText, richLinkAt, sanitizeRichHtml, stripPlainRich, updateRichLink };
|
|
1
|
+
export { t as escapeHtml, n as isSafeHref, r as markdownFromHtml, i as renderRichText, a as richLinkAt, o as sanitizeRichHtml, s as stripPlainRich, c as updateRichLink } from "./rich-text-70hddxMC.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/sections-manifest.ts
|
|
4
|
+
/** The two files `bearminion sync` writes next to the section directories. */
|
|
5
|
+
const DEFINITIONS_FILE = "definitions.gen.ts";
|
|
6
|
+
const COMPONENTS_FILE = "components.gen.ts";
|
|
7
|
+
/** A section directory that does not follow the convention. The message says what to fix. */
|
|
8
|
+
var SectionsError = class extends Error {};
|
|
9
|
+
const DIRECTORY_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
10
|
+
const toCamelCase = (dir) => dir.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
11
|
+
const toPascalCase = (dir) => {
|
|
12
|
+
const camel = toCamelCase(dir);
|
|
13
|
+
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Lists the section directories: every folder under `sectionsDir` that holds a `definition.ts`. Folders that start
|
|
17
|
+
* with `_` or `.` and folders without a definition are not sections. Sorted by name, so the result never depends on
|
|
18
|
+
* the file system.
|
|
19
|
+
*/
|
|
20
|
+
function scanSections(sectionsDir) {
|
|
21
|
+
if (!fs.existsSync(sectionsDir)) throw new SectionsError(`No sections folder at ${sectionsDir}.`);
|
|
22
|
+
const entries = [];
|
|
23
|
+
for (const child of fs.readdirSync(sectionsDir, { withFileTypes: true })) {
|
|
24
|
+
if (!child.isDirectory() || child.name.startsWith("_") || child.name.startsWith(".")) continue;
|
|
25
|
+
if (!fs.existsSync(path.join(sectionsDir, child.name, "definition.ts"))) continue;
|
|
26
|
+
if (!DIRECTORY_NAME.test(child.name)) throw new SectionsError(`"${child.name}" is not a usable section name. Use lowercase words joined by hyphens, such as "logo-strip": the directory name becomes the section type.`);
|
|
27
|
+
const component = toPascalCase(child.name);
|
|
28
|
+
if (!fs.existsSync(path.join(sectionsDir, child.name, `${component}.astro`))) throw new SectionsError(`${child.name}/ has a definition.ts but no ${component}.astro. The component is named after the directory.`);
|
|
29
|
+
entries.push({
|
|
30
|
+
dir: child.name,
|
|
31
|
+
key: toCamelCase(child.name),
|
|
32
|
+
component
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (entries.length === 0) throw new SectionsError(`No sections found in ${sectionsDir}. A section is a directory with a definition.ts.`);
|
|
36
|
+
return entries.sort((a, b) => a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0);
|
|
37
|
+
}
|
|
38
|
+
const HEADER = "// Generated by `bearminion sync`. Do not edit: add or remove a directory under sections/ and run it again.";
|
|
39
|
+
/** The contents of `definitions.gen.ts`: schemas only, no `.astro` imports, so `astro.config.ts` and the editor can load it. */
|
|
40
|
+
function renderDefinitions(entries) {
|
|
41
|
+
const imports = entries.map((entry) => `import { ${entry.key} } from './${entry.dir}/definition'`);
|
|
42
|
+
const keys = entries.map((entry) => ` ${entry.key},`);
|
|
43
|
+
return [
|
|
44
|
+
HEADER,
|
|
45
|
+
"import type { SectionRegistry } from 'bearminion'",
|
|
46
|
+
...imports,
|
|
47
|
+
"",
|
|
48
|
+
"export const sectionDefinitions = {",
|
|
49
|
+
...keys,
|
|
50
|
+
"} satisfies SectionRegistry",
|
|
51
|
+
""
|
|
52
|
+
].join("\n");
|
|
53
|
+
}
|
|
54
|
+
/** The contents of `components.gen.ts`: the section type to the component that renders it. */
|
|
55
|
+
function renderComponents(entries) {
|
|
56
|
+
const imports = entries.map((entry) => `import ${entry.component} from './${entry.dir}/${entry.component}.astro'`);
|
|
57
|
+
const map = entries.map((entry) => ` ${entry.key}: ${entry.component},`);
|
|
58
|
+
return [
|
|
59
|
+
HEADER,
|
|
60
|
+
"import type { SectionType } from './definitions'",
|
|
61
|
+
...imports,
|
|
62
|
+
"",
|
|
63
|
+
"/** Maps a content section `type` to the component that renders it. */",
|
|
64
|
+
"export const sectionComponents = {",
|
|
65
|
+
...map,
|
|
66
|
+
"} satisfies Record<SectionType, unknown>",
|
|
67
|
+
""
|
|
68
|
+
].join("\n");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Makes `definitions.gen.ts` and `components.gen.ts` match the section directories. With `check` it only reports
|
|
72
|
+
* which files are stale and writes nothing.
|
|
73
|
+
*/
|
|
74
|
+
function syncSections(sectionsDir, options = {}) {
|
|
75
|
+
const entries = scanSections(sectionsDir);
|
|
76
|
+
const wanted = {
|
|
77
|
+
[DEFINITIONS_FILE]: renderDefinitions(entries),
|
|
78
|
+
[COMPONENTS_FILE]: renderComponents(entries)
|
|
79
|
+
};
|
|
80
|
+
const changed = [];
|
|
81
|
+
for (const [file, content] of Object.entries(wanted)) {
|
|
82
|
+
const target = path.join(sectionsDir, file);
|
|
83
|
+
if ((fs.existsSync(target) ? fs.readFileSync(target, "utf8") : void 0) === content) continue;
|
|
84
|
+
changed.push(file);
|
|
85
|
+
if (!options.check) fs.writeFileSync(target, content);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
changed,
|
|
89
|
+
entries
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** The sentence for a build that stops on stale files, or for the dev server's warning. */
|
|
93
|
+
function staleSectionsMessage(changed) {
|
|
94
|
+
return `${changed.join(" and ")} no longer match the directories under sections/. Run \`npx bearminion sync\`.`;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { syncSections as i, scanSections as n, staleSectionsMessage as r, SectionsError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as tones, U as themeModes, V as buttonStyles } from "./page-
|
|
2
|
-
import { fontMarks } from "./marks.js";
|
|
1
|
+
import { G as tones, U as themeModes, V as buttonStyles } from "./page-X-WnOu7-.js";
|
|
2
|
+
import { i as fontMarks } from "./marks-DPBilumg.js";
|
|
3
3
|
//#region src/field-rules.ts
|
|
4
4
|
/**
|
|
5
5
|
* Field key of a path below a section's `props`: list indexes become `[]`.
|
package/dist/ui/mount.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as sectionFieldKey, i as isPropShown, t as defaultTheme } from "../theme-
|
|
2
|
-
import { B as withImageLayout, F as DEFAULT_IMAGE_POSITION, I as IMAGE_FITS, L as IMAGE_POSITIONS, P as DEFAULT_IMAGE_FIT, R as isImageFit, S as upsertJsonLd, b as parseJsonLdInput, g as isPlaceholderSiteUrl, i as isSystemPage, m as generateSiteJsonLd, p as formatJsonLd, v as jsonLdWarnings, z as isImagePosition } from "../page-
|
|
3
|
-
import {
|
|
1
|
+
import { a as sectionFieldKey, i as isPropShown, t as defaultTheme } from "../theme-Dv7_7B56.js";
|
|
2
|
+
import { B as withImageLayout, F as DEFAULT_IMAGE_POSITION, I as IMAGE_FITS, L as IMAGE_POSITIONS, P as DEFAULT_IMAGE_FIT, R as isImageFit, S as upsertJsonLd, b as parseJsonLdInput, g as isPlaceholderSiteUrl, i as isSystemPage, m as generateSiteJsonLd, p as formatJsonLd, v as jsonLdWarnings, z as isImagePosition } from "../page-X-WnOu7-.js";
|
|
3
|
+
import { d as reconcileMarks, f as renderMarkedHtml, i as fontMarks, l as marksFromEmphasis, t as applyTextMark } from "../marks-DPBilumg.js";
|
|
4
4
|
import { _ as consentCopy, b as parseMediaSource, c as hasThemeColors, d as tokenToHex, f as CONSENT_COPY, h as CONSENT_LIMITS, i as contrastChecks, n as HEX_COLOR, o as derivePalette, r as OVERRIDE_TOKENS, s as hasOverrides, t as DEFAULT_BRAND, u as themeCss, v as consentTextIssues } from "../theme-colors-CHROGZkI.js";
|
|
5
5
|
import { _ as writeSaveNotice, a as localDraftStorage, d as removeDraft, f as savedNoticeFor, g as writeDraftRecord, h as sweepExpiredDrafts, i as isForeignSave, l as readDraftRecord, m as siteSavedKey, n as draftBannerText, o as pageDraftKey, p as siteDraftKey, r as hashText, s as pageSavedKey, t as assessStoredDraft, u as reloadDecision, x as draftImageUsages } from "../draft-store-1Y4-sn45.js";
|
|
6
|
-
import {
|
|
6
|
+
import { a as richLinkAt, c as updateRichLink, i as renderRichText, n as isSafeHref, o as sanitizeRichHtml, r as markdownFromHtml, s as stripPlainRich } from "../rich-text-70hddxMC.js";
|
|
7
7
|
import { Component, Fragment, createContext, isValidElement, options, render } from "preact";
|
|
8
8
|
import { useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime";
|
|
@@ -14820,8 +14820,9 @@ function createLivePreview(doc, onRendered) {
|
|
|
14820
14820
|
//#endregion
|
|
14821
14821
|
//#region src/ui/state/edits.ts
|
|
14822
14822
|
/**
|
|
14823
|
-
* Text with a `data-field` on the page is updated where it is
|
|
14824
|
-
* video link, an `aria-label
|
|
14823
|
+
* Text with a `data-field` on the page is updated where it is while it is typed on the page. A value with no such
|
|
14824
|
+
* element (a video link, an `aria-label`, a section option), and any value typed in the sidebar, reaches the page
|
|
14825
|
+
* through a re-render.
|
|
14825
14826
|
*/
|
|
14826
14827
|
function shownInPlace(path) {
|
|
14827
14828
|
return document.querySelector(`[data-field="${CSS.escape(path)}"]`) !== null;
|
|
@@ -14860,7 +14861,7 @@ function createEdits(doc, preview) {
|
|
|
14860
14861
|
return;
|
|
14861
14862
|
}
|
|
14862
14863
|
doc.setDoc(path, editField(current, path, value));
|
|
14863
|
-
if (isPagePath(path) ? isImageField(path) || !shownInPlace(path) : affectsSitePreview(path)) previewFor(path);
|
|
14864
|
+
if (isPagePath(path) ? isImageField(path) || !shownInPlace(path) || !isEditingText() : affectsSitePreview(path)) previewFor(path);
|
|
14864
14865
|
}
|
|
14865
14866
|
function updatePage(next, withPreview = false) {
|
|
14866
14867
|
doc.page.value = next;
|
|
@@ -17596,6 +17597,18 @@ function MissingField({ name, path, sample, images, onField, onUploaded, onDelet
|
|
|
17596
17597
|
const fields = useContext(FieldsContext);
|
|
17597
17598
|
const key = sectionFieldKey(path);
|
|
17598
17599
|
const image = isImageField(name) || key !== null && (fields.images?.includes(key) ?? false);
|
|
17600
|
+
if (typeof sample === "boolean") return /* @__PURE__ */ jsx(ValueEditor, {
|
|
17601
|
+
label: name,
|
|
17602
|
+
value: false,
|
|
17603
|
+
path,
|
|
17604
|
+
rule: void 0,
|
|
17605
|
+
variant: void 0,
|
|
17606
|
+
sample: void 0,
|
|
17607
|
+
images,
|
|
17608
|
+
onField,
|
|
17609
|
+
onUploaded,
|
|
17610
|
+
onDeleted
|
|
17611
|
+
});
|
|
17599
17612
|
if (LINK_KEYS.has(name)) {
|
|
17600
17613
|
const fallback = {
|
|
17601
17614
|
label: "Button",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bearminion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "A git-based CMS for Astro with no database and no server: JSON content in your repo, edited by clicking on the page during astro dev.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jakub Lange",
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"node": ">=22.12.0"
|
|
28
28
|
},
|
|
29
29
|
"type": "module",
|
|
30
|
+
"bin": {
|
|
31
|
+
"bearminion": "./dist/cli.js"
|
|
32
|
+
},
|
|
30
33
|
"exports": {
|
|
31
34
|
".": {
|
|
32
35
|
"types": "./dist/index.d.ts",
|
|
@@ -56,6 +59,9 @@
|
|
|
56
59
|
},
|
|
57
60
|
"files": [
|
|
58
61
|
"dist",
|
|
62
|
+
"!dist/registry-build.js",
|
|
63
|
+
"!dist/registry-build.d.ts",
|
|
64
|
+
"registry",
|
|
59
65
|
"README.md",
|
|
60
66
|
"CHANGELOG.md",
|
|
61
67
|
"LICENSE"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ButtonSize, ButtonVariant } from './options'
|
|
3
|
+
import { cn } from '../../lib/cn'
|
|
4
|
+
import { button } from './button'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
variant?: ButtonVariant
|
|
8
|
+
size?: ButtonSize
|
|
9
|
+
href?: string
|
|
10
|
+
type?: 'button' | 'submit' | 'reset'
|
|
11
|
+
arrow?: boolean
|
|
12
|
+
class?: string
|
|
13
|
+
id?: string
|
|
14
|
+
/** When true, the link opens in a new window. External http(s) links do too unless this is false. */
|
|
15
|
+
newTab?: boolean
|
|
16
|
+
target?: string
|
|
17
|
+
rel?: string
|
|
18
|
+
'data-analytics'?: string
|
|
19
|
+
'data-field'?: string
|
|
20
|
+
'data-nav-toggle'?: boolean
|
|
21
|
+
'data-copy'?: boolean
|
|
22
|
+
'aria-expanded'?: 'true' | 'false' | boolean
|
|
23
|
+
'aria-controls'?: string
|
|
24
|
+
'aria-pressed'?: 'true' | 'false' | boolean
|
|
25
|
+
'aria-current'?: 'page' | 'true' | 'false' | boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
variant = 'primary',
|
|
30
|
+
size = 'md',
|
|
31
|
+
href,
|
|
32
|
+
type = 'button',
|
|
33
|
+
arrow = false,
|
|
34
|
+
class: className,
|
|
35
|
+
newTab,
|
|
36
|
+
target,
|
|
37
|
+
rel,
|
|
38
|
+
...rest
|
|
39
|
+
} = Astro.props
|
|
40
|
+
|
|
41
|
+
const external = typeof href === 'string' && /^https?:\/\//i.test(href)
|
|
42
|
+
const blank = newTab === true || (newTab !== false && external)
|
|
43
|
+
const classes = cn(button({ variant, size }), className)
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
href ? (
|
|
48
|
+
<a
|
|
49
|
+
href={href}
|
|
50
|
+
class={classes}
|
|
51
|
+
target={target ?? (blank ? '_blank' : undefined)}
|
|
52
|
+
rel={rel ?? (blank ? 'noopener noreferrer' : undefined)}
|
|
53
|
+
{...rest}
|
|
54
|
+
>
|
|
55
|
+
<slot />
|
|
56
|
+
{arrow && <span aria-hidden="true">→</span>}
|
|
57
|
+
</a>
|
|
58
|
+
) : (
|
|
59
|
+
<button type={type} class={classes} {...rest}>
|
|
60
|
+
<slot />
|
|
61
|
+
{arrow && <span aria-hidden="true">→</span>}
|
|
62
|
+
</button>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { markClass, marksFromEmphasis, splitMarkedText, type TextMark } from 'bearminion/marks'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
heading: string
|
|
6
|
+
marks?: TextMark[]
|
|
7
|
+
/** Legacy substring. Used when `marks` is omitted. */
|
|
8
|
+
em?: string
|
|
9
|
+
/** Field path for the full heading string. */
|
|
10
|
+
'data-field'?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { heading, marks, em, 'data-field': dataField } = Astro.props
|
|
14
|
+
const runs = splitMarkedText(heading, marks ?? marksFromEmphasis(heading, em))
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<span data-field={dataField}>
|
|
18
|
+
{
|
|
19
|
+
runs.map((run) => {
|
|
20
|
+
const cls = markClass(run)
|
|
21
|
+
return cls ? <span class={cls}>{run.text}</span> : run.text
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
</span>
|