@clevertask/scribe 0.0.15 → 0.1.1

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.
Files changed (66) hide show
  1. package/README.md +77 -27
  2. package/dist/BarMenu-DaKIz3zZ.js +327 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts +0 -1
  5. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  6. package/dist/components/Menu/BarMenu.js +8 -140
  7. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
  8. package/dist/components/Menu/BubbleMenu.js +2074 -159
  9. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  10. package/dist/components/Menu/Mobile/ListOptionBar.js +42 -22
  11. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +19 -1
  12. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/emoji/EmojiList.js +42 -42
  14. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -4
  15. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  16. package/dist/components/Scribe/extension/emoji/suggest.js +20 -15
  17. package/dist/components/Scribe/extension/extension-link.js +2 -984
  18. package/dist/components/Scribe/extension/extension-markdown-paste.js +4 -4
  19. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  20. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts +3 -0
  21. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -0
  22. package/dist/components/Scribe/extension/getPopupMountTarget.js +16 -0
  23. package/dist/components/Scribe/extension/index.d.ts +16 -2
  24. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  25. package/dist/components/Scribe/extension/index.js +37122 -34
  26. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +4 -1
  27. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
  28. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3730 -14
  29. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  30. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
  31. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  32. package/dist/components/Scribe/extension/slashCommand/renderItems.js +21 -16
  33. package/dist/components/Scribe/extension/tableOfContents.d.ts +48 -0
  34. package/dist/components/Scribe/extension/tableOfContents.d.ts.map +1 -0
  35. package/dist/components/Scribe/extension/tableOfContents.js +180 -0
  36. package/dist/components/Scribe/index.d.ts +12 -1
  37. package/dist/components/Scribe/index.d.ts.map +1 -1
  38. package/dist/components/Scribe/index.js +133 -87
  39. package/dist/extension-link-Ch_T7WWG.js +1030 -0
  40. package/dist/icons/ToolbarIcons.d.ts +19 -0
  41. package/dist/icons/ToolbarIcons.d.ts.map +1 -0
  42. package/dist/icons/ToolbarIcons.js +135 -0
  43. package/dist/{index-BKFDqQPh.js → index-BiBV5TQx.js} +6598 -5432
  44. package/dist/index-CqzMmrnw.js +1410 -0
  45. package/dist/index-DxF-1P4n.js +834 -0
  46. package/dist/index-V-gN11Y9.js +249 -0
  47. package/dist/main.css +200 -1123
  48. package/dist/main.js +1 -1
  49. package/dist/markdown-to-html-pL7ckd-m.js +1135 -0
  50. package/dist/purify.es-exIQuqhb.js +595 -0
  51. package/dist/tippy.esm-DLHdsnfG.js +1711 -0
  52. package/dist/utils/create-scribe-editor.d.ts +2 -2
  53. package/dist/utils/create-scribe-editor.d.ts.map +1 -1
  54. package/dist/utils/create-scribe-editor.js +3 -3
  55. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  56. package/dist/utils/html-to-markdown.js +583 -18
  57. package/dist/utils/index.js +1 -1
  58. package/dist/utils/markdown-to-html.js +2 -2
  59. package/package.json +34 -37
  60. package/dist/clsx-OuTLNxxd.js +0 -16
  61. package/dist/index-CL2WLiGu.js +0 -159
  62. package/dist/index-Cxf4VEm1.js +0 -50957
  63. package/dist/index-PzbCrHp0.js +0 -2349
  64. package/dist/markdown-to-html-__93dwok.js +0 -1557
  65. package/dist/purify.es-BPDBzHtc.js +0 -552
  66. package/dist/turndown.browser.es-RmA_HBaI.js +0 -649
@@ -1,10 +1,10 @@
1
- import { Editor } from "@tiptap/core";
1
+ import { Editor, JSONContent } from "@tiptap/core";
2
2
  export type CreateEditorOptions = {
3
3
  content?: string;
4
4
  editable?: boolean;
5
5
  onContentChange?: (content: {
6
6
  htmlContent: string;
7
- jsonContent: any;
7
+ jsonContent: JSONContent;
8
8
  markdownContent: string;
9
9
  }) => void;
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"create-scribe-editor.d.ts","sourceRoot":"","sources":["../../lib/utils/create-scribe-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,GAAG,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,OAAY,EACZ,QAAgB,EAChB,eAAe,GAChB,EAAE,mBAAmB,GAAG,MAAM,CAoB9B"}
1
+ {"version":3,"file":"create-scribe-editor.d.ts","sourceRoot":"","sources":["../../lib/utils/create-scribe-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAInD,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,WAAW,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;KACzB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,OAAY,EACZ,QAAgB,EAChB,eAAe,GAChB,EAAE,mBAAmB,GAAG,MAAM,CAoB9B"}
@@ -1,8 +1,8 @@
1
- import { E as i } from "../index-BKFDqQPh.js";
1
+ import { E as i } from "../index-BiBV5TQx.js";
2
2
  import { initExtensions as n } from "../components/Scribe/extension/index.js";
3
3
  import { html2md as m } from "./html-to-markdown.js";
4
- import "../markdown-to-html-__93dwok.js";
5
- import "../purify.es-BPDBzHtc.js";
4
+ import "../markdown-to-html-pL7ckd-m.js";
5
+ import "../purify.es-exIQuqhb.js";
6
6
  function d({
7
7
  content: r = "",
8
8
  editable: e = !1,
@@ -1 +1 @@
1
- {"version":3,"file":"html-to-markdown.d.ts","sourceRoot":"","sources":["../../lib/utils/html-to-markdown.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,WAkCnC,CAAC"}
1
+ {"version":3,"file":"html-to-markdown.d.ts","sourceRoot":"","sources":["../../lib/utils/html-to-markdown.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,WAiCnC,CAAC"}
@@ -1,35 +1,600 @@
1
- import { p as c } from "../purify.es-BPDBzHtc.js";
2
- import { T as i } from "../turndown.browser.es-RmA_HBaI.js";
3
- const p = (a) => {
4
- const e = new i({
1
+ import { p as $ } from "../purify.es-exIQuqhb.js";
2
+ function H(e) {
3
+ for (var t = 1; t < arguments.length; t++) {
4
+ var r = arguments[t];
5
+ for (var n in r)
6
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
7
+ }
8
+ return e;
9
+ }
10
+ function v(e, t) {
11
+ return Array(t + 1).join(e);
12
+ }
13
+ function C(e) {
14
+ return e.replace(/^\n*/, "");
15
+ }
16
+ function b(e) {
17
+ for (var t = e.length; t > 0 && e[t - 1] === `
18
+ `; ) t--;
19
+ return e.substring(0, t);
20
+ }
21
+ function S(e) {
22
+ return b(C(e));
23
+ }
24
+ var F = ["ADDRESS", "ARTICLE", "ASIDE", "AUDIO", "BLOCKQUOTE", "BODY", "CANVAS", "CENTER", "DD", "DIR", "DIV", "DL", "DT", "FIELDSET", "FIGCAPTION", "FIGURE", "FOOTER", "FORM", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6", "HEADER", "HGROUP", "HR", "HTML", "ISINDEX", "LI", "MAIN", "MENU", "NAV", "NOFRAMES", "NOSCRIPT", "OL", "OUTPUT", "P", "PRE", "SECTION", "TABLE", "TBODY", "TD", "TFOOT", "TH", "THEAD", "TR", "UL"];
25
+ function A(e) {
26
+ return y(e, F);
27
+ }
28
+ var w = ["AREA", "BASE", "BR", "COL", "COMMAND", "EMBED", "HR", "IMG", "INPUT", "KEYGEN", "LINK", "META", "PARAM", "SOURCE", "TRACK", "WBR"];
29
+ function O(e) {
30
+ return y(e, w);
31
+ }
32
+ function V(e) {
33
+ return B(e, w);
34
+ }
35
+ var D = ["A", "TABLE", "THEAD", "TBODY", "TFOOT", "TH", "TD", "IFRAME", "SCRIPT", "AUDIO", "VIDEO"];
36
+ function U(e) {
37
+ return y(e, D);
38
+ }
39
+ function W(e) {
40
+ return B(e, D);
41
+ }
42
+ function y(e, t) {
43
+ return t.indexOf(e.nodeName) >= 0;
44
+ }
45
+ function B(e, t) {
46
+ return e.getElementsByTagName && t.some(function(r) {
47
+ return e.getElementsByTagName(r).length;
48
+ });
49
+ }
50
+ var _ = [[/\\/g, "\\\\"], [/\*/g, "\\*"], [/^-/g, "\\-"], [/^\+ /g, "\\+ "], [/^(=+)/g, "\\$1"], [/^(#{1,6}) /g, "\\$1 "], [/`/g, "\\`"], [/^~~~/g, "\\~~~"], [/\[/g, "\\["], [/\]/g, "\\]"], [/^>/g, "\\>"], [/_/g, "\\_"], [/^(\d+)\. /g, "$1\\. "]];
51
+ function x(e) {
52
+ return _.reduce(function(t, r) {
53
+ return t.replace(r[0], r[1]);
54
+ }, e);
55
+ }
56
+ var o = {};
57
+ o.paragraph = {
58
+ filter: "p",
59
+ replacement: function(e) {
60
+ return `
61
+
62
+ ` + e + `
63
+
64
+ `;
65
+ }
66
+ };
67
+ o.lineBreak = {
68
+ filter: "br",
69
+ replacement: function(e, t, r) {
70
+ return r.br + `
71
+ `;
72
+ }
73
+ };
74
+ o.heading = {
75
+ filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
76
+ replacement: function(e, t, r) {
77
+ var n = Number(t.nodeName.charAt(1));
78
+ if (r.headingStyle === "setext" && n < 3) {
79
+ var i = v(n === 1 ? "=" : "-", e.length);
80
+ return `
81
+
82
+ ` + e + `
83
+ ` + i + `
84
+
85
+ `;
86
+ } else
87
+ return `
88
+
89
+ ` + v("#", n) + " " + e + `
90
+
91
+ `;
92
+ }
93
+ };
94
+ o.blockquote = {
95
+ filter: "blockquote",
96
+ replacement: function(e) {
97
+ return e = S(e).replace(/^/gm, "> "), `
98
+
99
+ ` + e + `
100
+
101
+ `;
102
+ }
103
+ };
104
+ o.list = {
105
+ filter: ["ul", "ol"],
106
+ replacement: function(e, t) {
107
+ var r = t.parentNode;
108
+ return r.nodeName === "LI" && r.lastElementChild === t ? `
109
+ ` + e : `
110
+
111
+ ` + e + `
112
+
113
+ `;
114
+ }
115
+ };
116
+ o.listItem = {
117
+ filter: "li",
118
+ replacement: function(e, t, r) {
119
+ var n = r.bulletListMarker + " ", i = t.parentNode;
120
+ if (i.nodeName === "OL") {
121
+ var a = i.getAttribute("start"), s = Array.prototype.indexOf.call(i.children, t);
122
+ n = (a ? Number(a) + s : s + 1) + ". ";
123
+ }
124
+ var u = /\n$/.test(e);
125
+ return e = S(e) + (u ? `
126
+ ` : ""), e = e.replace(/\n/gm, `
127
+ ` + " ".repeat(n.length)), n + e + (t.nextSibling ? `
128
+ ` : "");
129
+ }
130
+ };
131
+ o.indentedCodeBlock = {
132
+ filter: function(e, t) {
133
+ return t.codeBlockStyle === "indented" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
134
+ },
135
+ replacement: function(e, t, r) {
136
+ return `
137
+
138
+ ` + t.firstChild.textContent.replace(/\n/g, `
139
+ `) + `
140
+
141
+ `;
142
+ }
143
+ };
144
+ o.fencedCodeBlock = {
145
+ filter: function(e, t) {
146
+ return t.codeBlockStyle === "fenced" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
147
+ },
148
+ replacement: function(e, t, r) {
149
+ for (var n = t.firstChild.getAttribute("class") || "", i = (n.match(/language-(\S+)/) || [null, ""])[1], a = t.firstChild.textContent, s = r.fence.charAt(0), u = 3, l = new RegExp("^" + s + "{3,}", "gm"), c; c = l.exec(a); )
150
+ c[0].length >= u && (u = c[0].length + 1);
151
+ var f = v(s, u);
152
+ return `
153
+
154
+ ` + f + i + `
155
+ ` + a.replace(/\n$/, "") + `
156
+ ` + f + `
157
+
158
+ `;
159
+ }
160
+ };
161
+ o.horizontalRule = {
162
+ filter: "hr",
163
+ replacement: function(e, t, r) {
164
+ return `
165
+
166
+ ` + r.hr + `
167
+
168
+ `;
169
+ }
170
+ };
171
+ o.inlineLink = {
172
+ filter: function(e, t) {
173
+ return t.linkStyle === "inlined" && e.nodeName === "A" && e.getAttribute("href");
174
+ },
175
+ replacement: function(e, t) {
176
+ var r = N(t.getAttribute("href")), n = k(h(t.getAttribute("title"))), i = n ? ' "' + n + '"' : "";
177
+ return "[" + e + "](" + r + i + ")";
178
+ }
179
+ };
180
+ o.referenceLink = {
181
+ filter: function(e, t) {
182
+ return t.linkStyle === "referenced" && e.nodeName === "A" && e.getAttribute("href");
183
+ },
184
+ replacement: function(e, t, r) {
185
+ var n = N(t.getAttribute("href")), i = h(t.getAttribute("title"));
186
+ i && (i = ' "' + k(i) + '"');
187
+ var a, s;
188
+ switch (r.linkReferenceStyle) {
189
+ case "collapsed":
190
+ a = "[" + e + "][]", s = "[" + e + "]: " + n + i;
191
+ break;
192
+ case "shortcut":
193
+ a = "[" + e + "]", s = "[" + e + "]: " + n + i;
194
+ break;
195
+ default:
196
+ var u = this.references.length + 1;
197
+ a = "[" + e + "][" + u + "]", s = "[" + u + "]: " + n + i;
198
+ }
199
+ return this.references.push(s), a;
200
+ },
201
+ references: [],
202
+ append: function(e) {
203
+ var t = "";
204
+ return this.references.length && (t = `
205
+
206
+ ` + this.references.join(`
207
+ `) + `
208
+
209
+ `, this.references = []), t;
210
+ }
211
+ };
212
+ o.emphasis = {
213
+ filter: ["em", "i"],
214
+ replacement: function(e, t, r) {
215
+ return e.trim() ? r.emDelimiter + e + r.emDelimiter : "";
216
+ }
217
+ };
218
+ o.strong = {
219
+ filter: ["strong", "b"],
220
+ replacement: function(e, t, r) {
221
+ return e.trim() ? r.strongDelimiter + e + r.strongDelimiter : "";
222
+ }
223
+ };
224
+ o.code = {
225
+ filter: function(e) {
226
+ var t = e.previousSibling || e.nextSibling, r = e.parentNode.nodeName === "PRE" && !t;
227
+ return e.nodeName === "CODE" && !r;
228
+ },
229
+ replacement: function(e) {
230
+ if (!e) return "";
231
+ e = e.replace(/\r?\n|\r/g, " ");
232
+ for (var t = /^`|^ .*?[^ ].* $|`$/.test(e) ? " " : "", r = "`", n = e.match(/`+/gm) || []; n.indexOf(r) !== -1; ) r = r + "`";
233
+ return r + t + e + t + r;
234
+ }
235
+ };
236
+ o.image = {
237
+ filter: "img",
238
+ replacement: function(e, t) {
239
+ var r = x(h(t.getAttribute("alt"))), n = N(t.getAttribute("src") || ""), i = h(t.getAttribute("title")), a = i ? ' "' + k(i) + '"' : "";
240
+ return n ? "![" + r + "](" + n + a + ")" : "";
241
+ }
242
+ };
243
+ function h(e) {
244
+ return e ? e.replace(/(\n+\s*)+/g, `
245
+ `) : "";
246
+ }
247
+ function N(e) {
248
+ var t = e.replace(/([<>()])/g, "\\$1");
249
+ return t.indexOf(" ") >= 0 ? "<" + t + ">" : t;
250
+ }
251
+ function k(e) {
252
+ return e.replace(/"/g, '\\"');
253
+ }
254
+ function L(e) {
255
+ this.options = e, this._keep = [], this._remove = [], this.blankRule = {
256
+ replacement: e.blankReplacement
257
+ }, this.keepReplacement = e.keepReplacement, this.defaultRule = {
258
+ replacement: e.defaultReplacement
259
+ }, this.array = [];
260
+ for (var t in e.rules) this.array.push(e.rules[t]);
261
+ }
262
+ L.prototype = {
263
+ add: function(e, t) {
264
+ this.array.unshift(t);
265
+ },
266
+ keep: function(e) {
267
+ this._keep.unshift({
268
+ filter: e,
269
+ replacement: this.keepReplacement
270
+ });
271
+ },
272
+ remove: function(e) {
273
+ this._remove.unshift({
274
+ filter: e,
275
+ replacement: function() {
276
+ return "";
277
+ }
278
+ });
279
+ },
280
+ forNode: function(e) {
281
+ if (e.isBlank) return this.blankRule;
282
+ var t;
283
+ return (t = d(this.array, e, this.options)) || (t = d(this._keep, e, this.options)) || (t = d(this._remove, e, this.options)) ? t : this.defaultRule;
284
+ },
285
+ forEach: function(e) {
286
+ for (var t = 0; t < this.array.length; t++) e(this.array[t], t);
287
+ }
288
+ };
289
+ function d(e, t, r) {
290
+ for (var n = 0; n < e.length; n++) {
291
+ var i = e[n];
292
+ if (j(i, t, r)) return i;
293
+ }
294
+ }
295
+ function j(e, t, r) {
296
+ var n = e.filter;
297
+ if (typeof n == "string") {
298
+ if (n === t.nodeName.toLowerCase()) return !0;
299
+ } else if (Array.isArray(n)) {
300
+ if (n.indexOf(t.nodeName.toLowerCase()) > -1) return !0;
301
+ } else if (typeof n == "function") {
302
+ if (n.call(e, t, r)) return !0;
303
+ } else
304
+ throw new TypeError("`filter` needs to be a string, array, or function");
305
+ }
306
+ function G(e) {
307
+ var t = e.element, r = e.isBlock, n = e.isVoid, i = e.isPre || function(I) {
308
+ return I.nodeName === "PRE";
309
+ };
310
+ if (!(!t.firstChild || i(t))) {
311
+ for (var a = null, s = !1, u = null, l = T(u, t, i); l !== t; ) {
312
+ if (l.nodeType === 3 || l.nodeType === 4) {
313
+ var c = l.data.replace(/[ \r\n\t]+/g, " ");
314
+ if ((!a || / $/.test(a.data)) && !s && c[0] === " " && (c = c.substr(1)), !c) {
315
+ l = m(l);
316
+ continue;
317
+ }
318
+ l.data = c, a = l;
319
+ } else if (l.nodeType === 1)
320
+ r(l) || l.nodeName === "BR" ? (a && (a.data = a.data.replace(/ $/, "")), a = null, s = !1) : n(l) || i(l) ? (a = null, s = !0) : a && (s = !1);
321
+ else {
322
+ l = m(l);
323
+ continue;
324
+ }
325
+ var f = T(u, l, i);
326
+ u = l, l = f;
327
+ }
328
+ a && (a.data = a.data.replace(/ $/, ""), a.data || m(a));
329
+ }
330
+ }
331
+ function m(e) {
332
+ var t = e.nextSibling || e.parentNode;
333
+ return e.parentNode.removeChild(e), t;
334
+ }
335
+ function T(e, t, r) {
336
+ return e && e.parentNode === t || r(t) ? t.nextSibling || t.parentNode : t.firstChild || t.nextSibling || t.parentNode;
337
+ }
338
+ var E = typeof window < "u" ? window : {};
339
+ function X() {
340
+ var e = E.DOMParser, t = !1;
341
+ try {
342
+ new e().parseFromString("", "text/html") && (t = !0);
343
+ } catch {
344
+ }
345
+ return t;
346
+ }
347
+ function K() {
348
+ var e = function() {
349
+ };
350
+ return Y() ? e.prototype.parseFromString = function(t) {
351
+ var r = new window.ActiveXObject("htmlfile");
352
+ return r.designMode = "on", r.open(), r.write(t), r.close(), r;
353
+ } : e.prototype.parseFromString = function(t) {
354
+ var r = document.implementation.createHTMLDocument("");
355
+ return r.open(), r.write(t), r.close(), r;
356
+ }, e;
357
+ }
358
+ function Y() {
359
+ var e = !1;
360
+ try {
361
+ document.implementation.createHTMLDocument("").open();
362
+ } catch {
363
+ E.ActiveXObject && (e = !0);
364
+ }
365
+ return e;
366
+ }
367
+ var z = X() ? E.DOMParser : K();
368
+ function q(e, t) {
369
+ var r;
370
+ if (typeof e == "string") {
371
+ var n = Q().parseFromString(
372
+ // DOM parsers arrange elements in the <head> and <body>.
373
+ // Wrapping in a custom element ensures elements are reliably arranged in
374
+ // a single element.
375
+ '<x-turndown id="turndown-root">' + e + "</x-turndown>",
376
+ "text/html"
377
+ );
378
+ r = n.getElementById("turndown-root");
379
+ } else
380
+ r = e.cloneNode(!0);
381
+ return G({
382
+ element: r,
383
+ isBlock: A,
384
+ isVoid: O,
385
+ isPre: t.preformattedCode ? J : null
386
+ }), r;
387
+ }
388
+ var g;
389
+ function Q() {
390
+ return g = g || new z(), g;
391
+ }
392
+ function J(e) {
393
+ return e.nodeName === "PRE" || e.nodeName === "CODE";
394
+ }
395
+ function Z(e, t) {
396
+ return e.isBlock = A(e), e.isCode = e.nodeName === "CODE" || e.parentNode.isCode, e.isBlank = ee(e), e.flankingWhitespace = te(e, t), e;
397
+ }
398
+ function ee(e) {
399
+ return !O(e) && !U(e) && /^\s*$/i.test(e.textContent) && !V(e) && !W(e);
400
+ }
401
+ function te(e, t) {
402
+ if (e.isBlock || t.preformattedCode && e.isCode)
403
+ return {
404
+ leading: "",
405
+ trailing: ""
406
+ };
407
+ var r = re(e.textContent);
408
+ return r.leadingAscii && R("left", e, t) && (r.leading = r.leadingNonAscii), r.trailingAscii && R("right", e, t) && (r.trailing = r.trailingNonAscii), {
409
+ leading: r.leading,
410
+ trailing: r.trailing
411
+ };
412
+ }
413
+ function re(e) {
414
+ var t = e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
415
+ return {
416
+ leading: t[1],
417
+ // whole string for whitespace-only strings
418
+ leadingAscii: t[2],
419
+ leadingNonAscii: t[3],
420
+ trailing: t[4],
421
+ // empty for whitespace-only strings
422
+ trailingNonAscii: t[5],
423
+ trailingAscii: t[6]
424
+ };
425
+ }
426
+ function R(e, t, r) {
427
+ var n, i, a;
428
+ return e === "left" ? (n = t.previousSibling, i = / $/) : (n = t.nextSibling, i = /^ /), n && (n.nodeType === 3 ? a = i.test(n.nodeValue) : r.preformattedCode && n.nodeName === "CODE" ? a = !1 : n.nodeType === 1 && !A(n) && (a = i.test(n.textContent))), a;
429
+ }
430
+ var ne = Array.prototype.reduce;
431
+ function p(e) {
432
+ if (!(this instanceof p)) return new p(e);
433
+ var t = {
434
+ rules: o,
435
+ headingStyle: "setext",
436
+ hr: "* * *",
437
+ bulletListMarker: "*",
438
+ codeBlockStyle: "indented",
439
+ fence: "```",
440
+ emDelimiter: "_",
441
+ strongDelimiter: "**",
442
+ linkStyle: "inlined",
443
+ linkReferenceStyle: "full",
444
+ br: " ",
445
+ preformattedCode: !1,
446
+ blankReplacement: function(r, n) {
447
+ return n.isBlock ? `
448
+
449
+ ` : "";
450
+ },
451
+ keepReplacement: function(r, n) {
452
+ return n.isBlock ? `
453
+
454
+ ` + n.outerHTML + `
455
+
456
+ ` : n.outerHTML;
457
+ },
458
+ defaultReplacement: function(r, n) {
459
+ return n.isBlock ? `
460
+
461
+ ` + r + `
462
+
463
+ ` : r;
464
+ }
465
+ };
466
+ this.options = H({}, t, e), this.rules = new L(this.options);
467
+ }
468
+ p.prototype = {
469
+ /**
470
+ * The entry point for converting a string or DOM node to Markdown
471
+ * @public
472
+ * @param {String|HTMLElement} input The string or DOM node to convert
473
+ * @returns A Markdown representation of the input
474
+ * @type String
475
+ */
476
+ turndown: function(e) {
477
+ if (!le(e))
478
+ throw new TypeError(e + " is not a string, or an element/document/fragment node.");
479
+ if (e === "") return "";
480
+ var t = P.call(this, new q(e, this.options));
481
+ return ie.call(this, t);
482
+ },
483
+ /**
484
+ * Add one or more plugins
485
+ * @public
486
+ * @param {Function|Array} plugin The plugin or array of plugins to add
487
+ * @returns The Turndown instance for chaining
488
+ * @type Object
489
+ */
490
+ use: function(e) {
491
+ if (Array.isArray(e))
492
+ for (var t = 0; t < e.length; t++) this.use(e[t]);
493
+ else if (typeof e == "function")
494
+ e(this);
495
+ else
496
+ throw new TypeError("plugin must be a Function or an Array of Functions");
497
+ return this;
498
+ },
499
+ /**
500
+ * Adds a rule
501
+ * @public
502
+ * @param {String} key The unique key of the rule
503
+ * @param {Object} rule The rule
504
+ * @returns The Turndown instance for chaining
505
+ * @type Object
506
+ */
507
+ addRule: function(e, t) {
508
+ return this.rules.add(e, t), this;
509
+ },
510
+ /**
511
+ * Keep a node (as HTML) that matches the filter
512
+ * @public
513
+ * @param {String|Array|Function} filter The unique key of the rule
514
+ * @returns The Turndown instance for chaining
515
+ * @type Object
516
+ */
517
+ keep: function(e) {
518
+ return this.rules.keep(e), this;
519
+ },
520
+ /**
521
+ * Remove a node that matches the filter
522
+ * @public
523
+ * @param {String|Array|Function} filter The unique key of the rule
524
+ * @returns The Turndown instance for chaining
525
+ * @type Object
526
+ */
527
+ remove: function(e) {
528
+ return this.rules.remove(e), this;
529
+ },
530
+ /**
531
+ * Escapes Markdown syntax
532
+ * @public
533
+ * @param {String} string The string to escape
534
+ * @returns A string with Markdown syntax escaped
535
+ * @type String
536
+ */
537
+ escape: function(e) {
538
+ return x(e);
539
+ }
540
+ };
541
+ function P(e) {
542
+ var t = this;
543
+ return ne.call(e.childNodes, function(r, n) {
544
+ n = new Z(n, t.options);
545
+ var i = "";
546
+ return n.nodeType === 3 ? i = n.isCode ? n.nodeValue : t.escape(n.nodeValue) : n.nodeType === 1 && (i = ae.call(t, n)), M(r, i);
547
+ }, "");
548
+ }
549
+ function ie(e) {
550
+ var t = this;
551
+ return this.rules.forEach(function(r) {
552
+ typeof r.append == "function" && (e = M(e, r.append(t.options)));
553
+ }), e.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
554
+ }
555
+ function ae(e) {
556
+ var t = this.rules.forNode(e), r = P.call(this, e), n = e.flankingWhitespace;
557
+ return (n.leading || n.trailing) && (r = r.trim()), n.leading + t.replacement(r, e, this.options) + n.trailing;
558
+ }
559
+ function M(e, t) {
560
+ var r = b(e), n = C(t), i = Math.max(e.length - r.length, t.length - n.length), a = `
561
+
562
+ `.substring(0, i);
563
+ return r + a + n;
564
+ }
565
+ function le(e) {
566
+ return e != null && (typeof e == "string" || e.nodeType && (e.nodeType === 1 || e.nodeType === 9 || e.nodeType === 11));
567
+ }
568
+ const oe = (e) => {
569
+ const t = new p({
5
570
  headingStyle: "atx",
6
571
  hr: "---",
7
572
  bulletListMarker: "-",
8
573
  codeBlockStyle: "fenced"
9
574
  });
10
- e.addRule("latex", {
11
- filter: function(t) {
12
- return t.nodeName === "SPAN" && t.getAttribute("data-type") === "latex";
575
+ t.addRule("latex", {
576
+ filter: function(n) {
577
+ return n.nodeName === "SPAN" && n.getAttribute("data-type") === "latex";
13
578
  },
14
- replacement: function(t, n) {
15
- const r = n.getAttribute("data-content") || "";
16
- return n.getAttribute("data-display-mode") === "true" ? `
579
+ replacement: function(n, i) {
580
+ const a = i, s = a.getAttribute("data-content") || "";
581
+ return a.getAttribute("data-display-mode") === "true" ? `
17
582
 
18
583
  $$
19
- ${r}
584
+ ${s}
20
585
  $$
21
586
 
22
- ` : `$${r}$`;
587
+ ` : `$${s}$`;
23
588
  }
24
- }), e.addRule("strikethrough", {
589
+ }), t.addRule("strikethrough", {
25
590
  filter: ["del", "s"],
26
- replacement: function(t) {
27
- return "~~" + t + "~~";
591
+ replacement: function(n) {
592
+ return "~~" + n + "~~";
28
593
  }
29
594
  });
30
- const o = (t) => t.replace(/<span([^>]+data-type="latex"[^>]*)><\/span>/g, "<span$1>•</span>");
31
- return e.turndown(c.sanitize(o(a)));
595
+ const r = (n) => n.replace(/<span([^>]+data-type="latex"[^>]*)><\/span>/g, "<span$1>•</span>");
596
+ return t.turndown($.sanitize(r(e)));
32
597
  };
33
598
  export {
34
- p as html2md
599
+ oe as html2md
35
600
  };
@@ -1,5 +1,5 @@
1
1
  import { html2md as o } from "./html-to-markdown.js";
2
- import { m } from "../markdown-to-html-__93dwok.js";
2
+ import { m } from "../markdown-to-html-pL7ckd-m.js";
3
3
  import { isInViewport as p } from "./is-in-viewport.js";
4
4
  import { convertLegacyMathDelimiters as x } from "./convert-legacy-math-delimiters.js";
5
5
  import { createScribeEditor as c } from "./create-scribe-editor.js";
@@ -1,5 +1,5 @@
1
- import { m as t } from "../markdown-to-html-__93dwok.js";
2
- import "../purify.es-BPDBzHtc.js";
1
+ import { m as t } from "../markdown-to-html-pL7ckd-m.js";
2
+ import "../purify.es-exIQuqhb.js";
3
3
  export {
4
4
  t as md2html
5
5
  };