@milkdown/preset-commonmark 7.4.0 → 7.5.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/lib/index.es.js +156 -155
- package/lib/index.es.js.map +1 -1
- package/lib/node/hardbreak.d.ts.map +1 -1
- package/lib/plugin/sync-heading-id-plugin.d.ts.map +1 -1
- package/package.json +10 -16
- package/src/node/hardbreak.ts +3 -2
- package/src/node/html.ts +1 -1
- package/src/plugin/sync-heading-id-plugin.ts +3 -1
package/lib/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { $markAttr as
|
|
1
|
+
import { $markAttr as U, $markSchema as G, $command as c, $inputRule as h, $useKeymap as f, $node as Qe, $nodeAttr as N, $nodeSchema as I, $ctx as Xe, $remark as D, $prose as _ } from "@milkdown/utils";
|
|
2
2
|
import { remarkStringifyOptionsCtx as Ye, commandsCtx as u, editorViewCtx as At } from "@milkdown/core";
|
|
3
|
-
import { toggleMark as
|
|
3
|
+
import { toggleMark as J, setBlockType as K, wrapIn as Q } from "@milkdown/prose/commands";
|
|
4
4
|
import { Fragment as wt } from "@milkdown/prose/model";
|
|
5
5
|
import { expectDomTypeError as A } from "@milkdown/exception";
|
|
6
|
-
import { textblockTypeInputRule as Ze, wrappingInputRule as
|
|
6
|
+
import { textblockTypeInputRule as Ze, wrappingInputRule as X, InputRule as et } from "@milkdown/prose/inputrules";
|
|
7
7
|
import Ht from "@sindresorhus/slugify";
|
|
8
|
-
import { TextSelection as
|
|
9
|
-
import { markRule as
|
|
8
|
+
import { TextSelection as Y, Selection as tt, PluginKey as E, Plugin as P } from "@milkdown/prose/state";
|
|
9
|
+
import { markRule as j, findSelectedNodeOfType as Bt } from "@milkdown/prose";
|
|
10
10
|
import { sinkListItem as Rt, liftListItem as rt, splitListItem as vt } from "@milkdown/prose/schema-list";
|
|
11
11
|
import { ReplaceStep as Ot, AddMarkStep as Tt } from "@milkdown/prose/transform";
|
|
12
12
|
import { Decoration as ze, DecorationSet as Je } from "@milkdown/prose/view";
|
|
13
|
-
import { visit as
|
|
13
|
+
import { visit as Z } from "unist-util-visit";
|
|
14
14
|
import Kt from "remark-inline-links";
|
|
15
15
|
function at(t, e) {
|
|
16
16
|
var o;
|
|
@@ -31,12 +31,12 @@ function n(t, e) {
|
|
|
31
31
|
}
|
|
32
32
|
}), t;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
n(
|
|
34
|
+
const ee = U("emphasis");
|
|
35
|
+
n(ee, {
|
|
36
36
|
displayName: "Attr<emphasis>",
|
|
37
37
|
group: "Emphasis"
|
|
38
38
|
});
|
|
39
|
-
const R =
|
|
39
|
+
const R = G("emphasis", (t) => ({
|
|
40
40
|
attrs: {
|
|
41
41
|
marker: {
|
|
42
42
|
default: t.get(Ye).emphasis || "*"
|
|
@@ -47,7 +47,7 @@ const R = U("emphasis", (t) => ({
|
|
|
47
47
|
{ tag: "em" },
|
|
48
48
|
{ style: "font-style", getAttrs: (e) => e === "italic" }
|
|
49
49
|
],
|
|
50
|
-
toDOM: (e) => ["em", t.get(
|
|
50
|
+
toDOM: (e) => ["em", t.get(ee.key)(e)],
|
|
51
51
|
parseMarkdown: {
|
|
52
52
|
match: (e) => e.type === "emphasis",
|
|
53
53
|
runner: (e, r, a) => {
|
|
@@ -71,12 +71,12 @@ n(R.ctx, {
|
|
|
71
71
|
displayName: "MarkSchemaCtx<emphasis>",
|
|
72
72
|
group: "Emphasis"
|
|
73
73
|
});
|
|
74
|
-
const
|
|
75
|
-
n(
|
|
74
|
+
const te = c("ToggleEmphasis", (t) => () => J(R.type(t)));
|
|
75
|
+
n(te, {
|
|
76
76
|
displayName: "Command<toggleEmphasisCommand>",
|
|
77
77
|
group: "Emphasis"
|
|
78
78
|
});
|
|
79
|
-
const nt = h((t) =>
|
|
79
|
+
const nt = h((t) => j(/(?:^|[^*])\*([^*]+)\*$/, R.type(t), {
|
|
80
80
|
getAttr: () => ({
|
|
81
81
|
marker: "*"
|
|
82
82
|
}),
|
|
@@ -86,7 +86,7 @@ n(nt, {
|
|
|
86
86
|
displayName: "InputRule<emphasis>|Star",
|
|
87
87
|
group: "Emphasis"
|
|
88
88
|
});
|
|
89
|
-
const ot = h((t) =>
|
|
89
|
+
const ot = h((t) => j(/(?:^|[^_])_([^_]+)_$/, R.type(t), {
|
|
90
90
|
getAttr: () => ({
|
|
91
91
|
marker: "_"
|
|
92
92
|
}),
|
|
@@ -96,29 +96,29 @@ n(ot, {
|
|
|
96
96
|
displayName: "InputRule<emphasis>|Underscore",
|
|
97
97
|
group: "Emphasis"
|
|
98
98
|
});
|
|
99
|
-
const
|
|
99
|
+
const re = f("emphasisKeymap", {
|
|
100
100
|
ToggleEmphasis: {
|
|
101
101
|
shortcuts: "Mod-i",
|
|
102
102
|
command: (t) => {
|
|
103
103
|
const e = t.get(u);
|
|
104
|
-
return () => e.call(
|
|
104
|
+
return () => e.call(te.key);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
n(
|
|
108
|
+
n(re.ctx, {
|
|
109
109
|
displayName: "KeymapCtx<emphasis>",
|
|
110
110
|
group: "Emphasis"
|
|
111
111
|
});
|
|
112
|
-
n(
|
|
112
|
+
n(re.shortcuts, {
|
|
113
113
|
displayName: "Keymap<emphasis>",
|
|
114
114
|
group: "Emphasis"
|
|
115
115
|
});
|
|
116
|
-
const
|
|
117
|
-
n(
|
|
116
|
+
const ae = U("strong");
|
|
117
|
+
n(ae, {
|
|
118
118
|
displayName: "Attr<strong>",
|
|
119
119
|
group: "Strong"
|
|
120
120
|
});
|
|
121
|
-
const $ =
|
|
121
|
+
const $ = G("strong", (t) => ({
|
|
122
122
|
attrs: {
|
|
123
123
|
marker: {
|
|
124
124
|
default: t.get(Ye).strong || "*"
|
|
@@ -129,7 +129,7 @@ const $ = U("strong", (t) => ({
|
|
|
129
129
|
{ tag: "strong" },
|
|
130
130
|
{ style: "font-style", getAttrs: (e) => e === "bold" }
|
|
131
131
|
],
|
|
132
|
-
toDOM: (e) => ["strong", t.get(
|
|
132
|
+
toDOM: (e) => ["strong", t.get(ae.key)(e)],
|
|
133
133
|
parseMarkdown: {
|
|
134
134
|
match: (e) => e.type === "strong",
|
|
135
135
|
runner: (e, r, a) => {
|
|
@@ -153,12 +153,12 @@ n($.ctx, {
|
|
|
153
153
|
displayName: "MarkSchemaCtx<strong>",
|
|
154
154
|
group: "Strong"
|
|
155
155
|
});
|
|
156
|
-
const
|
|
157
|
-
n(
|
|
156
|
+
const ne = c("ToggleStrong", (t) => () => J($.type(t)));
|
|
157
|
+
n(ne, {
|
|
158
158
|
displayName: "Command<toggleStrongCommand>",
|
|
159
159
|
group: "Strong"
|
|
160
160
|
});
|
|
161
|
-
const st = h((t) =>
|
|
161
|
+
const st = h((t) => j(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, $.type(t), {
|
|
162
162
|
getAttr: (e) => ({
|
|
163
163
|
marker: e[0].startsWith("*") ? "*" : "_"
|
|
164
164
|
})
|
|
@@ -167,34 +167,34 @@ n(st, {
|
|
|
167
167
|
displayName: "InputRule<strong>",
|
|
168
168
|
group: "Strong"
|
|
169
169
|
});
|
|
170
|
-
const
|
|
170
|
+
const oe = f("strongKeymap", {
|
|
171
171
|
ToggleBold: {
|
|
172
172
|
shortcuts: ["Mod-b"],
|
|
173
173
|
command: (t) => {
|
|
174
174
|
const e = t.get(u);
|
|
175
|
-
return () => e.call(
|
|
175
|
+
return () => e.call(ne.key);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
|
-
n(
|
|
179
|
+
n(oe.ctx, {
|
|
180
180
|
displayName: "KeymapCtx<strong>",
|
|
181
181
|
group: "Strong"
|
|
182
182
|
});
|
|
183
|
-
n(
|
|
183
|
+
n(oe.shortcuts, {
|
|
184
184
|
displayName: "Keymap<strong>",
|
|
185
185
|
group: "Strong"
|
|
186
186
|
});
|
|
187
|
-
const
|
|
188
|
-
n(
|
|
187
|
+
const se = U("inlineCode");
|
|
188
|
+
n(se, {
|
|
189
189
|
displayName: "Attr<inlineCode>",
|
|
190
190
|
group: "InlineCode"
|
|
191
191
|
});
|
|
192
|
-
const x =
|
|
192
|
+
const x = G("inlineCode", (t) => ({
|
|
193
193
|
priority: 100,
|
|
194
194
|
code: !0,
|
|
195
195
|
inclusive: !1,
|
|
196
196
|
parseDOM: [{ tag: "code" }],
|
|
197
|
-
toDOM: (e) => ["code", t.get(
|
|
197
|
+
toDOM: (e) => ["code", t.get(se.key)(e)],
|
|
198
198
|
parseMarkdown: {
|
|
199
199
|
match: (e) => e.type === "inlineCode",
|
|
200
200
|
runner: (e, r, a) => {
|
|
@@ -216,7 +216,7 @@ n(x.ctx, {
|
|
|
216
216
|
displayName: "MarkSchemaCtx<inlineCode>",
|
|
217
217
|
group: "InlineCode"
|
|
218
218
|
});
|
|
219
|
-
const
|
|
219
|
+
const le = c("ToggleInlineCode", (t) => () => (e, r) => {
|
|
220
220
|
const { selection: a, tr: o } = e;
|
|
221
221
|
if (a.empty)
|
|
222
222
|
return !1;
|
|
@@ -225,38 +225,38 @@ const se = c("ToggleInlineCode", (t) => () => (e, r) => {
|
|
|
225
225
|
o.removeMark(s, l, m);
|
|
226
226
|
}), r == null || r(o.addMark(s, l, x.type(t).create())), !0);
|
|
227
227
|
});
|
|
228
|
-
n(
|
|
228
|
+
n(le, {
|
|
229
229
|
displayName: "Command<toggleInlineCodeCommand>",
|
|
230
230
|
group: "InlineCode"
|
|
231
231
|
});
|
|
232
|
-
const lt = h((t) =>
|
|
232
|
+
const lt = h((t) => j(/(?:\`)([^\`]+)(?:\`)$/, x.type(t)));
|
|
233
233
|
n(lt, {
|
|
234
234
|
displayName: "InputRule<inlineCodeInputRule>",
|
|
235
235
|
group: "InlineCode"
|
|
236
236
|
});
|
|
237
|
-
const
|
|
237
|
+
const ie = f("inlineCodeKeymap", {
|
|
238
238
|
ToggleInlineCode: {
|
|
239
239
|
shortcuts: "Mod-e",
|
|
240
240
|
command: (t) => {
|
|
241
241
|
const e = t.get(u);
|
|
242
|
-
return () => e.call(
|
|
242
|
+
return () => e.call(le.key);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
|
-
n(
|
|
246
|
+
n(ie.ctx, {
|
|
247
247
|
displayName: "KeymapCtx<inlineCode>",
|
|
248
248
|
group: "InlineCode"
|
|
249
249
|
});
|
|
250
|
-
n(
|
|
250
|
+
n(ie.shortcuts, {
|
|
251
251
|
displayName: "Keymap<inlineCode>",
|
|
252
252
|
group: "InlineCode"
|
|
253
253
|
});
|
|
254
|
-
const
|
|
255
|
-
n(
|
|
254
|
+
const de = U("link");
|
|
255
|
+
n(de, {
|
|
256
256
|
displayName: "Attr<link>",
|
|
257
257
|
group: "Link"
|
|
258
258
|
});
|
|
259
|
-
const B =
|
|
259
|
+
const B = G("link", (t) => ({
|
|
260
260
|
attrs: {
|
|
261
261
|
href: {},
|
|
262
262
|
title: { default: null }
|
|
@@ -271,7 +271,7 @@ const B = U("link", (t) => ({
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
],
|
|
274
|
-
toDOM: (e) => ["a", { ...t.get(
|
|
274
|
+
toDOM: (e) => ["a", { ...t.get(de.key)(e), ...e.attrs }],
|
|
275
275
|
parseMarkdown: {
|
|
276
276
|
match: (e) => e.type === "link",
|
|
277
277
|
runner: (e, r, a) => {
|
|
@@ -293,7 +293,7 @@ n(B.mark, {
|
|
|
293
293
|
displayName: "MarkSchema<link>",
|
|
294
294
|
group: "Link"
|
|
295
295
|
});
|
|
296
|
-
const it = c("ToggleLink", (t) => (e = {}) =>
|
|
296
|
+
const it = c("ToggleLink", (t) => (e = {}) => J(B.type(t), e));
|
|
297
297
|
n(it, {
|
|
298
298
|
displayName: "Command<toggleLinkCommand>",
|
|
299
299
|
group: "Link"
|
|
@@ -313,7 +313,7 @@ const dt = c("UpdateLink", (t) => (e = {}) => (r, a) => {
|
|
|
313
313
|
return !1;
|
|
314
314
|
const p = s, y = s + o.nodeSize, { tr: g } = r, C = B.type(t).create({ ...m.attrs, ...e });
|
|
315
315
|
return C ? (a(
|
|
316
|
-
g.removeMark(p, y, m).addMark(p, y, C).setSelection(new
|
|
316
|
+
g.removeMark(p, y, m).addMark(p, y, C).setSelection(new Y(g.selection.$anchor)).scrollIntoView()
|
|
317
317
|
), !0) : !1;
|
|
318
318
|
});
|
|
319
319
|
n(dt, {
|
|
@@ -339,8 +339,8 @@ n(mt, {
|
|
|
339
339
|
displayName: "NodeSchema<doc>",
|
|
340
340
|
group: "Doc"
|
|
341
341
|
});
|
|
342
|
-
const
|
|
343
|
-
n(
|
|
342
|
+
const me = N("paragraph");
|
|
343
|
+
n(me, {
|
|
344
344
|
displayName: "Attr<paragraph>",
|
|
345
345
|
group: "Paragraph"
|
|
346
346
|
});
|
|
@@ -348,7 +348,7 @@ const w = I("paragraph", (t) => ({
|
|
|
348
348
|
content: "inline*",
|
|
349
349
|
group: "block",
|
|
350
350
|
parseDOM: [{ tag: "p" }],
|
|
351
|
-
toDOM: (e) => ["p", t.get(
|
|
351
|
+
toDOM: (e) => ["p", t.get(me.key)(e), 0],
|
|
352
352
|
parseMarkdown: {
|
|
353
353
|
match: (e) => e.type === "paragraph",
|
|
354
354
|
runner: (e, r, a) => {
|
|
@@ -370,25 +370,25 @@ n(w.ctx, {
|
|
|
370
370
|
displayName: "NodeSchemaCtx<paragraph>",
|
|
371
371
|
group: "Paragraph"
|
|
372
372
|
});
|
|
373
|
-
const
|
|
374
|
-
n(
|
|
373
|
+
const pe = c("TurnIntoText", (t) => () => K(w.type(t)));
|
|
374
|
+
n(pe, {
|
|
375
375
|
displayName: "Command<turnIntoTextCommand>",
|
|
376
376
|
group: "Paragraph"
|
|
377
377
|
});
|
|
378
|
-
const
|
|
378
|
+
const ce = f("paragraphKeymap", {
|
|
379
379
|
TurnIntoText: {
|
|
380
380
|
shortcuts: "Mod-Alt-0",
|
|
381
381
|
command: (t) => {
|
|
382
382
|
const e = t.get(u);
|
|
383
|
-
return () => e.call(
|
|
383
|
+
return () => e.call(pe.key);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
|
-
n(
|
|
387
|
+
n(ce.ctx, {
|
|
388
388
|
displayName: "KeymapCtx<paragraph>",
|
|
389
389
|
group: "Paragraph"
|
|
390
390
|
});
|
|
391
|
-
n(
|
|
391
|
+
n(ce.shortcuts, {
|
|
392
392
|
displayName: "Keymap<paragraph>",
|
|
393
393
|
group: "Paragraph"
|
|
394
394
|
});
|
|
@@ -396,18 +396,18 @@ const Dt = Array(6).fill(0).map((t, e) => e + 1);
|
|
|
396
396
|
function _t(t) {
|
|
397
397
|
return Ht(t.textContent);
|
|
398
398
|
}
|
|
399
|
-
const
|
|
400
|
-
n(
|
|
399
|
+
const z = Xe(_t, "headingIdGenerator");
|
|
400
|
+
n(z, {
|
|
401
401
|
displayName: "Ctx<HeadingIdGenerator>",
|
|
402
402
|
group: "Heading"
|
|
403
403
|
});
|
|
404
|
-
const
|
|
405
|
-
n(
|
|
404
|
+
const ue = N("heading");
|
|
405
|
+
n(ue, {
|
|
406
406
|
displayName: "Attr<heading>",
|
|
407
407
|
group: "Heading"
|
|
408
408
|
});
|
|
409
409
|
const H = I("heading", (t) => {
|
|
410
|
-
const e = t.get(
|
|
410
|
+
const e = t.get(z.key);
|
|
411
411
|
return {
|
|
412
412
|
content: "inline*",
|
|
413
413
|
group: "block",
|
|
@@ -431,7 +431,7 @@ const H = I("heading", (t) => {
|
|
|
431
431
|
toDOM: (r) => [
|
|
432
432
|
`h${r.attrs.level}`,
|
|
433
433
|
{
|
|
434
|
-
...t.get(
|
|
434
|
+
...t.get(ue.key)(r),
|
|
435
435
|
id: r.attrs.id || e(r)
|
|
436
436
|
},
|
|
437
437
|
0
|
|
@@ -477,7 +477,7 @@ n(L, {
|
|
|
477
477
|
displayName: "Command<wrapInHeadingCommand>",
|
|
478
478
|
group: "Heading"
|
|
479
479
|
});
|
|
480
|
-
const
|
|
480
|
+
const ge = c("DowngradeHeading", (t) => () => (e, r, a) => {
|
|
481
481
|
const { $from: o } = e.selection, s = o.node();
|
|
482
482
|
if (s.type !== H.type(t) || !e.selection.empty || o.parentOffset !== 0)
|
|
483
483
|
return !1;
|
|
@@ -489,11 +489,11 @@ const ue = c("DowngradeHeading", (t) => () => (e, r, a) => {
|
|
|
489
489
|
})
|
|
490
490
|
), !0) : K(w.type(t))(e, r, a);
|
|
491
491
|
});
|
|
492
|
-
n(
|
|
492
|
+
n(ge, {
|
|
493
493
|
displayName: "Command<downgradeHeadingCommand>",
|
|
494
494
|
group: "Heading"
|
|
495
495
|
});
|
|
496
|
-
const
|
|
496
|
+
const ke = f("headingKeymap", {
|
|
497
497
|
TurnIntoH1: {
|
|
498
498
|
shortcuts: "Mod-Alt-1",
|
|
499
499
|
command: (t) => {
|
|
@@ -540,20 +540,20 @@ const ge = f("headingKeymap", {
|
|
|
540
540
|
shortcuts: ["Delete", "Backspace"],
|
|
541
541
|
command: (t) => {
|
|
542
542
|
const e = t.get(u);
|
|
543
|
-
return () => e.call(
|
|
543
|
+
return () => e.call(ge.key);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
|
-
n(
|
|
547
|
+
n(ke.ctx, {
|
|
548
548
|
displayName: "KeymapCtx<heading>",
|
|
549
549
|
group: "Heading"
|
|
550
550
|
});
|
|
551
|
-
n(
|
|
551
|
+
n(ke.shortcuts, {
|
|
552
552
|
displayName: "Keymap<heading>",
|
|
553
553
|
group: "Heading"
|
|
554
554
|
});
|
|
555
|
-
const
|
|
556
|
-
n(
|
|
555
|
+
const ye = N("blockquote");
|
|
556
|
+
n(ye, {
|
|
557
557
|
displayName: "Attr<blockquote>",
|
|
558
558
|
group: "Blockquote"
|
|
559
559
|
});
|
|
@@ -562,7 +562,7 @@ const q = I("blockquote", (t) => ({
|
|
|
562
562
|
group: "block",
|
|
563
563
|
defining: !0,
|
|
564
564
|
parseDOM: [{ tag: "blockquote" }],
|
|
565
|
-
toDOM: (e) => ["blockquote", t.get(
|
|
565
|
+
toDOM: (e) => ["blockquote", t.get(ye.key)(e), 0],
|
|
566
566
|
parseMarkdown: {
|
|
567
567
|
match: ({ type: e }) => e === "blockquote",
|
|
568
568
|
runner: (e, r, a) => {
|
|
@@ -584,38 +584,38 @@ n(q.ctx, {
|
|
|
584
584
|
displayName: "NodeSchemaCtx<blockquote>",
|
|
585
585
|
group: "Blockquote"
|
|
586
586
|
});
|
|
587
|
-
const ct = h((t) =>
|
|
587
|
+
const ct = h((t) => X(/^\s*>\s$/, q.type(t)));
|
|
588
588
|
n(ct, {
|
|
589
589
|
displayName: "InputRule<wrapInBlockquoteInputRule>",
|
|
590
590
|
group: "Blockquote"
|
|
591
591
|
});
|
|
592
|
-
const
|
|
593
|
-
n(
|
|
592
|
+
const he = c("WrapInBlockquote", (t) => () => Q(q.type(t)));
|
|
593
|
+
n(he, {
|
|
594
594
|
displayName: "Command<wrapInBlockquoteCommand>",
|
|
595
595
|
group: "Blockquote"
|
|
596
596
|
});
|
|
597
|
-
const
|
|
597
|
+
const fe = f("blockquoteKeymap", {
|
|
598
598
|
WrapInBlockquote: {
|
|
599
599
|
shortcuts: "Mod-Shift-b",
|
|
600
600
|
command: (t) => {
|
|
601
601
|
const e = t.get(u);
|
|
602
|
-
return () => e.call(
|
|
602
|
+
return () => e.call(he.key);
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
});
|
|
606
|
-
n(
|
|
606
|
+
n(fe.ctx, {
|
|
607
607
|
displayName: "KeymapCtx<blockquote>",
|
|
608
608
|
group: "Blockquote"
|
|
609
609
|
});
|
|
610
|
-
n(
|
|
610
|
+
n(fe.shortcuts, {
|
|
611
611
|
displayName: "Keymap<blockquote>",
|
|
612
612
|
group: "Blockquote"
|
|
613
613
|
});
|
|
614
|
-
const
|
|
614
|
+
const Ne = N("codeBlock", () => ({
|
|
615
615
|
pre: {},
|
|
616
616
|
code: {}
|
|
617
617
|
}));
|
|
618
|
-
n(
|
|
618
|
+
n(Ne, {
|
|
619
619
|
displayName: "Attr<codeBlock>",
|
|
620
620
|
group: "CodeBlock"
|
|
621
621
|
});
|
|
@@ -642,7 +642,7 @@ const W = I("code_block", (t) => ({
|
|
|
642
642
|
}
|
|
643
643
|
],
|
|
644
644
|
toDOM: (e) => {
|
|
645
|
-
const r = t.get(
|
|
645
|
+
const r = t.get(Ne.key)(e);
|
|
646
646
|
return [
|
|
647
647
|
"pre",
|
|
648
648
|
{
|
|
@@ -687,8 +687,8 @@ n(ut, {
|
|
|
687
687
|
displayName: "InputRule<createCodeBlockInputRule>",
|
|
688
688
|
group: "CodeBlock"
|
|
689
689
|
});
|
|
690
|
-
const
|
|
691
|
-
n(
|
|
690
|
+
const Ie = c("CreateCodeBlock", (t) => (e = "") => K(W.type(t), { language: e }));
|
|
691
|
+
n(Ie, {
|
|
692
692
|
displayName: "Command<createCodeBlockCommand>",
|
|
693
693
|
group: "CodeBlock"
|
|
694
694
|
});
|
|
@@ -697,25 +697,25 @@ n(Et, {
|
|
|
697
697
|
displayName: "Command<updateCodeBlockLanguageCommand>",
|
|
698
698
|
group: "CodeBlock"
|
|
699
699
|
});
|
|
700
|
-
const
|
|
700
|
+
const Ce = f("codeBlockKeymap", {
|
|
701
701
|
CreateCodeBlock: {
|
|
702
702
|
shortcuts: "Mod-Alt-c",
|
|
703
703
|
command: (t) => {
|
|
704
704
|
const e = t.get(u);
|
|
705
|
-
return () => e.call(
|
|
705
|
+
return () => e.call(Ie.key);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
|
-
n(
|
|
709
|
+
n(Ce.ctx, {
|
|
710
710
|
displayName: "KeymapCtx<codeBlock>",
|
|
711
711
|
group: "CodeBlock"
|
|
712
712
|
});
|
|
713
|
-
n(
|
|
713
|
+
n(Ce.shortcuts, {
|
|
714
714
|
displayName: "Keymap<codeBlock>",
|
|
715
715
|
group: "CodeBlock"
|
|
716
716
|
});
|
|
717
|
-
const
|
|
718
|
-
n(
|
|
717
|
+
const Me = N("image");
|
|
718
|
+
n(Me, {
|
|
719
719
|
displayName: "Attr<image>",
|
|
720
720
|
group: "Image"
|
|
721
721
|
});
|
|
@@ -747,7 +747,7 @@ const v = I("image", (t) => ({
|
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
],
|
|
750
|
-
toDOM: (e) => ["img", { ...t.get(
|
|
750
|
+
toDOM: (e) => ["img", { ...t.get(Me.key)(e), ...e.attrs }],
|
|
751
751
|
parseMarkdown: {
|
|
752
752
|
match: ({ type: e }) => e === "image",
|
|
753
753
|
runner: (e, r, a) => {
|
|
@@ -810,10 +810,11 @@ n(Pt, {
|
|
|
810
810
|
displayName: "InputRule<insertImageInputRule>",
|
|
811
811
|
group: "Image"
|
|
812
812
|
});
|
|
813
|
-
const
|
|
813
|
+
const V = N("hardbreak", (t) => ({
|
|
814
|
+
"data-type": "hardbreak",
|
|
814
815
|
"data-is-inline": t.attrs.isInline
|
|
815
816
|
}));
|
|
816
|
-
n(
|
|
817
|
+
n(V, {
|
|
817
818
|
displayName: "Attr<hardbreak>",
|
|
818
819
|
group: "Hardbreak"
|
|
819
820
|
});
|
|
@@ -826,8 +827,8 @@ const S = I("hardbreak", (t) => ({
|
|
|
826
827
|
}
|
|
827
828
|
},
|
|
828
829
|
selectable: !1,
|
|
829
|
-
parseDOM: [{ tag: "br" }],
|
|
830
|
-
toDOM: (e) => ["br", t.get(
|
|
830
|
+
parseDOM: [{ tag: "br" }, { tag: 'span[data-type="hardbreak"]', getAttrs: () => ({ isInline: !0 }) }],
|
|
831
|
+
toDOM: (e) => e.attrs.isInline ? ["span", t.get(V.key)(e), " "] : ["br", t.get(V.key)(e)],
|
|
831
832
|
parseMarkdown: {
|
|
832
833
|
match: ({ type: e }) => e === "break",
|
|
833
834
|
runner: (e, r, a) => {
|
|
@@ -856,7 +857,7 @@ n(S.ctx, {
|
|
|
856
857
|
const be = c("InsertHardbreak", (t) => () => (e, r) => {
|
|
857
858
|
var s;
|
|
858
859
|
const { selection: a, tr: o } = e;
|
|
859
|
-
if (!(a instanceof
|
|
860
|
+
if (!(a instanceof Y))
|
|
860
861
|
return !1;
|
|
861
862
|
if (a.empty) {
|
|
862
863
|
const l = a.$from.node();
|
|
@@ -997,12 +998,12 @@ n(O.ctx, {
|
|
|
997
998
|
displayName: "NodeSchemaCtx<bulletList>",
|
|
998
999
|
group: "BulletList"
|
|
999
1000
|
});
|
|
1000
|
-
const ft = h((t) =>
|
|
1001
|
+
const ft = h((t) => X(/^\s*([-+*])\s$/, O.type(t)));
|
|
1001
1002
|
n(ft, {
|
|
1002
1003
|
displayName: "InputRule<wrapInBulletListInputRule>",
|
|
1003
1004
|
group: "BulletList"
|
|
1004
1005
|
});
|
|
1005
|
-
const Ae = c("WrapInBulletList", (t) => () =>
|
|
1006
|
+
const Ae = c("WrapInBulletList", (t) => () => Q(O.type(t)));
|
|
1006
1007
|
n(Ae, {
|
|
1007
1008
|
displayName: "Command<wrapInBulletListCommand>",
|
|
1008
1009
|
group: "BulletList"
|
|
@@ -1084,7 +1085,7 @@ n(T.ctx, {
|
|
|
1084
1085
|
displayName: "NodeSchemaCtx<orderedList>",
|
|
1085
1086
|
group: "OrderedList"
|
|
1086
1087
|
});
|
|
1087
|
-
const Nt = h((t) =>
|
|
1088
|
+
const Nt = h((t) => X(
|
|
1088
1089
|
/^\s*(\d+)\.\s$/,
|
|
1089
1090
|
T.type(t),
|
|
1090
1091
|
(e) => ({ order: Number(e[1]) }),
|
|
@@ -1094,7 +1095,7 @@ n(Nt, {
|
|
|
1094
1095
|
displayName: "InputRule<wrapInOrderedListInputRule>",
|
|
1095
1096
|
group: "OrderedList"
|
|
1096
1097
|
});
|
|
1097
|
-
const Be = c("WrapInOrderedList", (t) => () =>
|
|
1098
|
+
const Be = c("WrapInOrderedList", (t) => () => Q(T.type(t)));
|
|
1098
1099
|
n(Be, {
|
|
1099
1100
|
displayName: "Command<wrapInOrderedListCommand>",
|
|
1100
1101
|
group: "OrderedList"
|
|
@@ -1200,7 +1201,7 @@ n(Ke, {
|
|
|
1200
1201
|
function $t(t) {
|
|
1201
1202
|
return (e, r, a) => {
|
|
1202
1203
|
const { selection: o } = e;
|
|
1203
|
-
if (!(o instanceof
|
|
1204
|
+
if (!(o instanceof Y))
|
|
1204
1205
|
return !1;
|
|
1205
1206
|
const { empty: s, $from: l } = o;
|
|
1206
1207
|
if (!s || l.parentOffset !== 0)
|
|
@@ -1322,20 +1323,20 @@ n(Pe.ctx, {
|
|
|
1322
1323
|
});
|
|
1323
1324
|
const qt = [
|
|
1324
1325
|
mt,
|
|
1325
|
-
|
|
1326
|
+
me,
|
|
1326
1327
|
w,
|
|
1327
|
-
|
|
1328
|
-
|
|
1328
|
+
z,
|
|
1329
|
+
ue,
|
|
1329
1330
|
H,
|
|
1330
|
-
|
|
1331
|
+
V,
|
|
1331
1332
|
S,
|
|
1332
|
-
|
|
1333
|
+
ye,
|
|
1333
1334
|
q,
|
|
1334
|
-
|
|
1335
|
+
Ne,
|
|
1335
1336
|
W,
|
|
1336
1337
|
xe,
|
|
1337
1338
|
F,
|
|
1338
|
-
|
|
1339
|
+
Me,
|
|
1339
1340
|
v,
|
|
1340
1341
|
Se,
|
|
1341
1342
|
O,
|
|
@@ -1343,13 +1344,13 @@ const qt = [
|
|
|
1343
1344
|
T,
|
|
1344
1345
|
ve,
|
|
1345
1346
|
M,
|
|
1346
|
-
|
|
1347
|
+
ee,
|
|
1347
1348
|
R,
|
|
1348
|
-
|
|
1349
|
+
ae,
|
|
1349
1350
|
$,
|
|
1350
|
-
|
|
1351
|
+
se,
|
|
1351
1352
|
x,
|
|
1352
|
-
|
|
1353
|
+
de,
|
|
1353
1354
|
B,
|
|
1354
1355
|
Ee,
|
|
1355
1356
|
Pe,
|
|
@@ -1367,11 +1368,11 @@ const qt = [
|
|
|
1367
1368
|
lt,
|
|
1368
1369
|
st
|
|
1369
1370
|
], Vt = [
|
|
1370
|
-
|
|
1371
|
-
|
|
1371
|
+
pe,
|
|
1372
|
+
he,
|
|
1372
1373
|
L,
|
|
1373
|
-
|
|
1374
|
-
|
|
1374
|
+
ge,
|
|
1375
|
+
Ie,
|
|
1375
1376
|
be,
|
|
1376
1377
|
ht,
|
|
1377
1378
|
gt,
|
|
@@ -1382,25 +1383,25 @@ const qt = [
|
|
|
1382
1383
|
Ke,
|
|
1383
1384
|
Te,
|
|
1384
1385
|
De,
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1386
|
+
te,
|
|
1387
|
+
le,
|
|
1388
|
+
ne,
|
|
1388
1389
|
it,
|
|
1389
1390
|
dt
|
|
1390
1391
|
], Ut = [
|
|
1391
|
-
|
|
1392
|
-
|
|
1392
|
+
fe,
|
|
1393
|
+
Ce,
|
|
1393
1394
|
Le,
|
|
1394
|
-
|
|
1395
|
+
ke,
|
|
1395
1396
|
_e,
|
|
1396
1397
|
Re,
|
|
1397
1398
|
we,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1399
|
+
ce,
|
|
1400
|
+
re,
|
|
1401
|
+
ie,
|
|
1402
|
+
oe
|
|
1402
1403
|
].flat(), $e = D("remarkAddOrderInList", () => () => (t) => {
|
|
1403
|
-
|
|
1404
|
+
Z(t, "list", (e) => {
|
|
1404
1405
|
if (e.ordered) {
|
|
1405
1406
|
const r = e.start ?? 1;
|
|
1406
1407
|
e.children.forEach((a, o) => {
|
|
@@ -1419,7 +1420,7 @@ n($e.options, {
|
|
|
1419
1420
|
});
|
|
1420
1421
|
const qe = D("remarkLineBreak", () => () => (t) => {
|
|
1421
1422
|
const e = /[\t ]*(?:\r?\n|\r)/g;
|
|
1422
|
-
|
|
1423
|
+
Z(t, "text", (r, a, o) => {
|
|
1423
1424
|
if (!r.value || typeof r.value != "string")
|
|
1424
1425
|
return;
|
|
1425
1426
|
const s = [];
|
|
@@ -1486,7 +1487,7 @@ n(Fe.options, {
|
|
|
1486
1487
|
});
|
|
1487
1488
|
const Ve = D("remarkMarker", () => () => (t, e) => {
|
|
1488
1489
|
const r = (a) => e.value.charAt(a.position.start.offset);
|
|
1489
|
-
|
|
1490
|
+
Z(t, (a) => ["strong", "emphasis"].includes(a.type), (a) => {
|
|
1490
1491
|
a.marker = r(a);
|
|
1491
1492
|
});
|
|
1492
1493
|
});
|
|
@@ -1607,7 +1608,7 @@ const Lt = _((t) => {
|
|
|
1607
1608
|
const e = new E("MILKDOWN_HEADING_ID"), r = (a) => {
|
|
1608
1609
|
if (a.composing)
|
|
1609
1610
|
return;
|
|
1610
|
-
const o = t.get(
|
|
1611
|
+
const o = t.get(z.key), s = a.state.tr.setMeta("addToHistory", !1);
|
|
1611
1612
|
let l = !1;
|
|
1612
1613
|
a.state.doc.descendants((i, d) => {
|
|
1613
1614
|
if (i.type === H.type(t)) {
|
|
@@ -1624,8 +1625,8 @@ const Lt = _((t) => {
|
|
|
1624
1625
|
return new P({
|
|
1625
1626
|
key: e,
|
|
1626
1627
|
view: (a) => (r(a), {
|
|
1627
|
-
update: (o) => {
|
|
1628
|
-
r(o);
|
|
1628
|
+
update: (o, s) => {
|
|
1629
|
+
o.state.doc.eq(s.doc) || r(o);
|
|
1629
1630
|
}
|
|
1630
1631
|
})
|
|
1631
1632
|
});
|
|
@@ -1688,45 +1689,45 @@ const Jt = [
|
|
|
1688
1689
|
xt
|
|
1689
1690
|
].flat(), cr = [qt, Wt, Ft, Vt, Ut, Jt].flat();
|
|
1690
1691
|
export {
|
|
1691
|
-
|
|
1692
|
-
|
|
1692
|
+
ye as blockquoteAttr,
|
|
1693
|
+
fe as blockquoteKeymap,
|
|
1693
1694
|
q as blockquoteSchema,
|
|
1694
1695
|
Se as bulletListAttr,
|
|
1695
1696
|
we as bulletListKeymap,
|
|
1696
1697
|
O as bulletListSchema,
|
|
1697
|
-
|
|
1698
|
-
|
|
1698
|
+
Ne as codeBlockAttr,
|
|
1699
|
+
Ce as codeBlockKeymap,
|
|
1699
1700
|
W as codeBlockSchema,
|
|
1700
1701
|
Vt as commands,
|
|
1701
1702
|
cr as commonmark,
|
|
1702
|
-
|
|
1703
|
+
Ie as createCodeBlockCommand,
|
|
1703
1704
|
ut as createCodeBlockInputRule,
|
|
1704
1705
|
mt as docSchema,
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1706
|
+
ge as downgradeHeadingCommand,
|
|
1707
|
+
ee as emphasisAttr,
|
|
1708
|
+
re as emphasisKeymap,
|
|
1708
1709
|
R as emphasisSchema,
|
|
1709
1710
|
nt as emphasisStarInputRule,
|
|
1710
1711
|
ot as emphasisUnderscoreInputRule,
|
|
1711
|
-
|
|
1712
|
+
V as hardbreakAttr,
|
|
1712
1713
|
Mt as hardbreakClearMarkPlugin,
|
|
1713
1714
|
Ue as hardbreakFilterNodes,
|
|
1714
1715
|
bt as hardbreakFilterPlugin,
|
|
1715
1716
|
Le as hardbreakKeymap,
|
|
1716
1717
|
S as hardbreakSchema,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1718
|
+
ue as headingAttr,
|
|
1719
|
+
z as headingIdGenerator,
|
|
1720
|
+
ke as headingKeymap,
|
|
1720
1721
|
H as headingSchema,
|
|
1721
1722
|
xe as hrAttr,
|
|
1722
1723
|
F as hrSchema,
|
|
1723
1724
|
Ee as htmlAttr,
|
|
1724
1725
|
Pe as htmlSchema,
|
|
1725
|
-
|
|
1726
|
+
Me as imageAttr,
|
|
1726
1727
|
v as imageSchema,
|
|
1727
|
-
|
|
1728
|
+
se as inlineCodeAttr,
|
|
1728
1729
|
lt as inlineCodeInputRule,
|
|
1729
|
-
|
|
1730
|
+
ie as inlineCodeKeymap,
|
|
1730
1731
|
x as inlineCodeSchema,
|
|
1731
1732
|
Ct as inlineNodesCursorPlugin,
|
|
1732
1733
|
Wt as inputRules,
|
|
@@ -1738,7 +1739,7 @@ export {
|
|
|
1738
1739
|
Ut as keymap,
|
|
1739
1740
|
De as liftFirstListItemCommand,
|
|
1740
1741
|
Te as liftListItemCommand,
|
|
1741
|
-
|
|
1742
|
+
de as linkAttr,
|
|
1742
1743
|
B as linkSchema,
|
|
1743
1744
|
ve as listItemAttr,
|
|
1744
1745
|
_e as listItemKeymap,
|
|
@@ -1747,8 +1748,8 @@ export {
|
|
|
1747
1748
|
He as orderedListAttr,
|
|
1748
1749
|
Re as orderedListKeymap,
|
|
1749
1750
|
T as orderedListSchema,
|
|
1750
|
-
|
|
1751
|
-
|
|
1751
|
+
me as paragraphAttr,
|
|
1752
|
+
ce as paragraphKeymap,
|
|
1752
1753
|
w as paragraphSchema,
|
|
1753
1754
|
Jt as plugins,
|
|
1754
1755
|
$e as remarkAddOrderInListPlugin,
|
|
@@ -1759,22 +1760,22 @@ export {
|
|
|
1759
1760
|
qt as schema,
|
|
1760
1761
|
Oe as sinkListItemCommand,
|
|
1761
1762
|
Ke as splitListItemCommand,
|
|
1762
|
-
|
|
1763
|
+
ae as strongAttr,
|
|
1763
1764
|
st as strongInputRule,
|
|
1764
|
-
|
|
1765
|
+
oe as strongKeymap,
|
|
1765
1766
|
$ as strongSchema,
|
|
1766
1767
|
Lt as syncHeadingIdPlugin,
|
|
1767
1768
|
xt as syncListOrderPlugin,
|
|
1768
1769
|
It as textSchema,
|
|
1769
|
-
|
|
1770
|
-
|
|
1770
|
+
te as toggleEmphasisCommand,
|
|
1771
|
+
le as toggleInlineCodeCommand,
|
|
1771
1772
|
it as toggleLinkCommand,
|
|
1772
|
-
|
|
1773
|
-
|
|
1773
|
+
ne as toggleStrongCommand,
|
|
1774
|
+
pe as turnIntoTextCommand,
|
|
1774
1775
|
Et as updateCodeBlockLanguageCommand,
|
|
1775
1776
|
kt as updateImageCommand,
|
|
1776
1777
|
dt as updateLinkCommand,
|
|
1777
|
-
|
|
1778
|
+
he as wrapInBlockquoteCommand,
|
|
1778
1779
|
ct as wrapInBlockquoteInputRule,
|
|
1779
1780
|
Ae as wrapInBulletListCommand,
|
|
1780
1781
|
ft as wrapInBulletListInputRule,
|