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