@milkdown/preset-commonmark 7.5.9 → 7.6.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 (2) hide show
  1. package/lib/index.es.js +137 -137
  2. package/package.json +8 -8
package/lib/index.es.js CHANGED
@@ -1,17 +1,17 @@
1
- import { $markAttr as U, $markSchema as G, $command as u, $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";
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 v, $prose as _ } from "@milkdown/utils";
2
2
  import { remarkStringifyOptionsCtx as Ye, commandsCtx as g, editorViewCtx as At } from "@milkdown/core";
3
- import { toggleMark as J, setBlockType as K, wrapIn as Q } from "@milkdown/prose/commands";
3
+ import { toggleMark as J, setBlockType as D, 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
6
  import { textblockTypeInputRule as Ze, wrappingInputRule as X, InputRule as et } from "@milkdown/prose/inputrules";
7
7
  import Ht from "@sindresorhus/slugify";
8
8
  import { TextSelection as Y, Selection as tt, PluginKey as E, Plugin as P } from "@milkdown/prose/state";
9
9
  import { markRule as j, findSelectedNodeOfType as Bt } from "@milkdown/prose";
10
- import { sinkListItem as Rt, liftListItem as rt, splitListItem as vt } from "@milkdown/prose/schema-list";
11
- import { ReplaceStep as Ot, AddMarkStep as Tt } from "@milkdown/prose/transform";
10
+ import { sinkListItem as Rt, liftListItem as rt, splitListItem as Ot } from "@milkdown/prose/schema-list";
11
+ import { ReplaceStep as Tt, AddMarkStep as Kt } from "@milkdown/prose/transform";
12
12
  import { Decoration as ze, DecorationSet as Je } from "@milkdown/prose/view";
13
13
  import { visit as Z } from "unist-util-visit";
14
- import Kt from "remark-inline-links";
14
+ import Dt from "remark-inline-links";
15
15
  function at(t, e) {
16
16
  var o;
17
17
  if (!(e.childCount >= 1 && ((o = e.lastChild) == null ? void 0 : o.type.name) === "hardbreak")) {
@@ -71,7 +71,7 @@ n(R.ctx, {
71
71
  displayName: "MarkSchemaCtx<emphasis>",
72
72
  group: "Emphasis"
73
73
  });
74
- const te = u("ToggleEmphasis", (t) => () => J(R.type(t)));
74
+ const te = c("ToggleEmphasis", (t) => () => J(R.type(t)));
75
75
  n(te, {
76
76
  displayName: "Command<toggleEmphasisCommand>",
77
77
  group: "Emphasis"
@@ -153,7 +153,7 @@ n($.ctx, {
153
153
  displayName: "MarkSchemaCtx<strong>",
154
154
  group: "Strong"
155
155
  });
156
- const ne = u("ToggleStrong", (t) => () => J($.type(t)));
156
+ const ne = c("ToggleStrong", (t) => () => J($.type(t)));
157
157
  n(ne, {
158
158
  displayName: "Command<toggleStrongCommand>",
159
159
  group: "Strong"
@@ -216,7 +216,7 @@ n(x.ctx, {
216
216
  displayName: "MarkSchemaCtx<inlineCode>",
217
217
  group: "InlineCode"
218
218
  });
219
- const le = u(
219
+ const le = c(
220
220
  "ToggleInlineCode",
221
221
  (t) => () => (e, r) => {
222
222
  const { selection: a, tr: o } = e;
@@ -299,7 +299,7 @@ n(B.mark, {
299
299
  displayName: "MarkSchema<link>",
300
300
  group: "Link"
301
301
  });
302
- const it = u(
302
+ const it = c(
303
303
  "ToggleLink",
304
304
  (t) => (e = {}) => J(B.type(t), e)
305
305
  );
@@ -307,7 +307,7 @@ n(it, {
307
307
  displayName: "Command<toggleLinkCommand>",
308
308
  group: "Link"
309
309
  });
310
- const dt = u(
310
+ const dt = c(
311
311
  "UpdateLink",
312
312
  (t) => (e = {}) => (r, a) => {
313
313
  if (!a) return !1;
@@ -319,9 +319,9 @@ const dt = u(
319
319
  }), !o) return !1;
320
320
  const m = o.marks.find(({ type: y }) => y === B.type(t));
321
321
  if (!m) return !1;
322
- const p = s, c = s + o.nodeSize, { tr: k } = r, C = B.type(t).create({ ...m.attrs, ...e });
322
+ const u = s, p = s + o.nodeSize, { tr: k } = r, C = B.type(t).create({ ...m.attrs, ...e });
323
323
  return C ? (a(
324
- k.removeMark(p, c, m).addMark(p, c, C).setSelection(new Y(k.selection.$anchor)).scrollIntoView()
324
+ k.removeMark(u, p, m).addMark(u, p, C).setSelection(new Y(k.selection.$anchor)).scrollIntoView()
325
325
  ), !0) : !1;
326
326
  }
327
327
  );
@@ -379,32 +379,32 @@ n(w.ctx, {
379
379
  displayName: "NodeSchemaCtx<paragraph>",
380
380
  group: "Paragraph"
381
381
  });
382
- const pe = u(
382
+ const ue = c(
383
383
  "TurnIntoText",
384
- (t) => () => K(w.type(t))
384
+ (t) => () => D(w.type(t))
385
385
  );
386
- n(pe, {
386
+ n(ue, {
387
387
  displayName: "Command<turnIntoTextCommand>",
388
388
  group: "Paragraph"
389
389
  });
390
- const ce = f("paragraphKeymap", {
390
+ const pe = f("paragraphKeymap", {
391
391
  TurnIntoText: {
392
392
  shortcuts: "Mod-Alt-0",
393
393
  command: (t) => {
394
394
  const e = t.get(g);
395
- return () => e.call(pe.key);
395
+ return () => e.call(ue.key);
396
396
  }
397
397
  }
398
398
  });
399
- n(ce.ctx, {
399
+ n(pe.ctx, {
400
400
  displayName: "KeymapCtx<paragraph>",
401
401
  group: "Paragraph"
402
402
  });
403
- n(ce.shortcuts, {
403
+ n(pe.shortcuts, {
404
404
  displayName: "Keymap<paragraph>",
405
405
  group: "Paragraph"
406
406
  });
407
- const Dt = Array(6).fill(0).map((t, e) => e + 1);
407
+ const vt = Array(6).fill(0).map((t, e) => e + 1);
408
408
  function _t(t) {
409
409
  return Ht(t.textContent);
410
410
  }
@@ -416,8 +416,8 @@ n(z, {
416
416
  displayName: "Ctx<HeadingIdGenerator>",
417
417
  group: "Heading"
418
418
  });
419
- const ue = N("heading");
420
- n(ue, {
419
+ const ce = N("heading");
420
+ n(ce, {
421
421
  displayName: "Attr<heading>",
422
422
  group: "Heading"
423
423
  });
@@ -435,7 +435,7 @@ const H = I("heading", (t) => {
435
435
  default: 1
436
436
  }
437
437
  },
438
- parseDOM: Dt.map((r) => ({
438
+ parseDOM: vt.map((r) => ({
439
439
  tag: `h${r}`,
440
440
  getAttrs: (a) => {
441
441
  if (!(a instanceof HTMLElement)) throw A(a);
@@ -445,7 +445,7 @@ const H = I("heading", (t) => {
445
445
  toDOM: (r) => [
446
446
  `h${r.attrs.level}`,
447
447
  {
448
- ...t.get(ue.key)(r),
448
+ ...t.get(ce.key)(r),
449
449
  id: r.attrs.id || e(r)
450
450
  },
451
451
  0
@@ -473,7 +473,7 @@ n(H.ctx, {
473
473
  displayName: "NodeSchemaCtx<heading>",
474
474
  group: "Heading"
475
475
  });
476
- const pt = h((t) => Ze(
476
+ const ut = h((t) => Ze(
477
477
  /^(?<hashes>#+)\s$/,
478
478
  H.type(t),
479
479
  (e) => {
@@ -486,16 +486,16 @@ const pt = h((t) => Ze(
486
486
  return { level: r };
487
487
  }
488
488
  ));
489
- n(pt, {
489
+ n(ut, {
490
490
  displayName: "InputRule<wrapInHeadingInputRule>",
491
491
  group: "Heading"
492
492
  });
493
- const L = u("WrapInHeading", (t) => (e) => (e ?? (e = 1), e < 1 ? K(w.type(t)) : K(H.type(t), { level: e })));
493
+ const L = c("WrapInHeading", (t) => (e) => (e ?? (e = 1), e < 1 ? D(w.type(t)) : D(H.type(t), { level: e })));
494
494
  n(L, {
495
495
  displayName: "Command<wrapInHeadingCommand>",
496
496
  group: "Heading"
497
497
  });
498
- const ge = u(
498
+ const ge = c(
499
499
  "DowngradeHeading",
500
500
  (t) => () => (e, r, a) => {
501
501
  const { $from: o } = e.selection, s = o.node();
@@ -507,7 +507,7 @@ const ge = u(
507
507
  ...s.attrs,
508
508
  level: l
509
509
  })
510
- ), !0) : K(w.type(t))(e, r, a);
510
+ ), !0) : D(w.type(t))(e, r, a);
511
511
  }
512
512
  );
513
513
  n(ge, {
@@ -608,14 +608,14 @@ n(q.ctx, {
608
608
  displayName: "NodeSchemaCtx<blockquote>",
609
609
  group: "Blockquote"
610
610
  });
611
- const ct = h(
611
+ const pt = h(
612
612
  (t) => X(/^\s*>\s$/, q.type(t))
613
613
  );
614
- n(ct, {
614
+ n(pt, {
615
615
  displayName: "InputRule<wrapInBlockquoteInputRule>",
616
616
  group: "Blockquote"
617
617
  });
618
- const he = u(
618
+ const he = c(
619
619
  "WrapInBlockquote",
620
620
  (t) => () => Q(q.type(t))
621
621
  );
@@ -705,7 +705,7 @@ n(W.ctx, {
705
705
  displayName: "NodeSchemaCtx<codeBlock>",
706
706
  group: "CodeBlock"
707
707
  });
708
- const ut = h(
708
+ const ct = h(
709
709
  (t) => Ze(
710
710
  /^```(?<language>[a-z]*)?[\s\n]$/,
711
711
  W.type(t),
@@ -717,19 +717,19 @@ const ut = h(
717
717
  }
718
718
  )
719
719
  );
720
- n(ut, {
720
+ n(ct, {
721
721
  displayName: "InputRule<createCodeBlockInputRule>",
722
722
  group: "CodeBlock"
723
723
  });
724
- const Ie = u(
724
+ const Ie = c(
725
725
  "CreateCodeBlock",
726
- (t) => (e = "") => K(W.type(t), { language: e })
726
+ (t) => (e = "") => D(W.type(t), { language: e })
727
727
  );
728
728
  n(Ie, {
729
729
  displayName: "Command<createCodeBlockCommand>",
730
730
  group: "CodeBlock"
731
731
  });
732
- const Et = u(
732
+ const Et = c(
733
733
  "UpdateCodeBlockLanguage",
734
734
  () => ({ pos: t, language: e } = {
735
735
  pos: -1,
@@ -762,7 +762,7 @@ n(Me, {
762
762
  displayName: "Attr<image>",
763
763
  group: "Image"
764
764
  });
765
- const v = I("image", (t) => ({
765
+ const O = I("image", (t) => ({
766
766
  inline: !0,
767
767
  group: "inline",
768
768
  selectable: !0,
@@ -812,19 +812,19 @@ const v = I("image", (t) => ({
812
812
  }
813
813
  }
814
814
  }));
815
- n(v.node, {
815
+ n(O.node, {
816
816
  displayName: "NodeSchema<image>",
817
817
  group: "Image"
818
818
  });
819
- n(v.ctx, {
819
+ n(O.ctx, {
820
820
  displayName: "NodeSchemaCtx<image>",
821
821
  group: "Image"
822
822
  });
823
- const gt = u(
823
+ const gt = c(
824
824
  "InsertImage",
825
825
  (t) => (e = {}) => (r, a) => {
826
826
  if (!a) return !0;
827
- const { src: o = "", alt: s = "", title: l = "" } = e, i = v.type(t).create({ src: o, alt: s, title: l });
827
+ const { src: o = "", alt: s = "", title: l = "" } = e, i = O.type(t).create({ src: o, alt: s, title: l });
828
828
  return i && a(r.tr.replaceSelectionWith(i).scrollIntoView()), !0;
829
829
  }
830
830
  );
@@ -832,16 +832,16 @@ n(gt, {
832
832
  displayName: "Command<insertImageCommand>",
833
833
  group: "Image"
834
834
  });
835
- const kt = u(
835
+ const kt = c(
836
836
  "UpdateImage",
837
837
  (t) => (e = {}) => (r, a) => {
838
838
  const o = Bt(
839
839
  r.selection,
840
- v.type(t)
840
+ O.type(t)
841
841
  );
842
842
  if (!o) return !1;
843
- const { node: s, pos: l } = o, i = { ...s.attrs }, { src: d, alt: m, title: p } = e;
844
- return d !== void 0 && (i.src = d), m !== void 0 && (i.alt = m), p !== void 0 && (i.title = p), a == null || a(
843
+ const { node: s, pos: l } = o, i = { ...s.attrs }, { src: d, alt: m, title: u } = e;
844
+ return d !== void 0 && (i.src = d), m !== void 0 && (i.alt = m), u !== void 0 && (i.title = u), a == null || a(
845
845
  r.tr.setNodeMarkup(l, void 0, i).scrollIntoView()
846
846
  ), !0;
847
847
  }
@@ -858,7 +858,7 @@ const Pt = h(
858
858
  return s ? e.tr.replaceWith(
859
859
  a,
860
860
  o,
861
- v.type(t).create({ src: i, alt: l, title: d })
861
+ O.type(t).create({ src: i, alt: l, title: d })
862
862
  ) : null;
863
863
  }
864
864
  )
@@ -919,7 +919,7 @@ n(S.ctx, {
919
919
  displayName: "NodeSchemaCtx<hardbreak>",
920
920
  group: "Hardbreak"
921
921
  });
922
- const be = u(
922
+ const be = c(
923
923
  "InsertHardbreak",
924
924
  (t) => () => (e, r) => {
925
925
  var s;
@@ -1002,7 +1002,7 @@ n(yt, {
1002
1002
  displayName: "InputRule<insertHrInputRule>",
1003
1003
  group: "Hr"
1004
1004
  });
1005
- const ht = u(
1005
+ const ht = c(
1006
1006
  "InsertHr",
1007
1007
  (t) => () => (e, r) => {
1008
1008
  if (!r) return !0;
@@ -1021,7 +1021,7 @@ n(Se, {
1021
1021
  displayName: "Attr<bulletList>",
1022
1022
  group: "BulletList"
1023
1023
  });
1024
- const O = I("bullet_list", (t) => ({
1024
+ const T = I("bullet_list", (t) => ({
1025
1025
  content: "listItem+",
1026
1026
  group: "block",
1027
1027
  attrs: {
@@ -1065,24 +1065,24 @@ const O = I("bullet_list", (t) => ({
1065
1065
  }
1066
1066
  }
1067
1067
  }));
1068
- n(O.node, {
1068
+ n(T.node, {
1069
1069
  displayName: "NodeSchema<bulletList>",
1070
1070
  group: "BulletList"
1071
1071
  });
1072
- n(O.ctx, {
1072
+ n(T.ctx, {
1073
1073
  displayName: "NodeSchemaCtx<bulletList>",
1074
1074
  group: "BulletList"
1075
1075
  });
1076
1076
  const ft = h(
1077
- (t) => X(/^\s*([-+*])\s$/, O.type(t))
1077
+ (t) => X(/^\s*([-+*])\s$/, T.type(t))
1078
1078
  );
1079
1079
  n(ft, {
1080
1080
  displayName: "InputRule<wrapInBulletListInputRule>",
1081
1081
  group: "BulletList"
1082
1082
  });
1083
- const Ae = u(
1083
+ const Ae = c(
1084
1084
  "WrapInBulletList",
1085
- (t) => () => Q(O.type(t))
1085
+ (t) => () => Q(T.type(t))
1086
1086
  );
1087
1087
  n(Ae, {
1088
1088
  displayName: "Command<wrapInBulletListCommand>",
@@ -1110,7 +1110,7 @@ n(He, {
1110
1110
  displayName: "Attr<orderedList>",
1111
1111
  group: "OrderedList"
1112
1112
  });
1113
- const T = I("ordered_list", (t) => ({
1113
+ const K = I("ordered_list", (t) => ({
1114
1114
  content: "listItem+",
1115
1115
  group: "block",
1116
1116
  attrs: {
@@ -1160,18 +1160,18 @@ const T = I("ordered_list", (t) => ({
1160
1160
  }
1161
1161
  }
1162
1162
  }));
1163
- n(T.node, {
1163
+ n(K.node, {
1164
1164
  displayName: "NodeSchema<orderedList>",
1165
1165
  group: "OrderedList"
1166
1166
  });
1167
- n(T.ctx, {
1167
+ n(K.ctx, {
1168
1168
  displayName: "NodeSchemaCtx<orderedList>",
1169
1169
  group: "OrderedList"
1170
1170
  });
1171
1171
  const Nt = h(
1172
1172
  (t) => X(
1173
1173
  /^\s*(\d+)\.\s$/,
1174
- T.type(t),
1174
+ K.type(t),
1175
1175
  (e) => ({ order: Number(e[1]) }),
1176
1176
  (e, r) => r.childCount + r.attrs.order === Number(e[1])
1177
1177
  )
@@ -1180,9 +1180,9 @@ n(Nt, {
1180
1180
  displayName: "InputRule<wrapInOrderedListInputRule>",
1181
1181
  group: "OrderedList"
1182
1182
  });
1183
- const Be = u(
1183
+ const Be = c(
1184
1184
  "WrapInOrderedList",
1185
- (t) => () => Q(T.type(t))
1185
+ (t) => () => Q(K.type(t))
1186
1186
  );
1187
1187
  n(Be, {
1188
1188
  displayName: "Command<wrapInOrderedListCommand>",
@@ -1205,8 +1205,8 @@ n(Re.shortcuts, {
1205
1205
  displayName: "Keymap<orderedList>",
1206
1206
  group: "OrderedList"
1207
1207
  });
1208
- const ve = N("listItem");
1209
- n(ve, {
1208
+ const Oe = N("listItem");
1209
+ n(Oe, {
1210
1210
  displayName: "Attr<listItem>",
1211
1211
  group: "ListItem"
1212
1212
  });
@@ -1241,7 +1241,7 @@ const M = I("list_item", (t) => ({
1241
1241
  toDOM: (e) => [
1242
1242
  "li",
1243
1243
  {
1244
- ...t.get(ve.key)(e),
1244
+ ...t.get(Oe.key)(e),
1245
1245
  "data-label": e.attrs.label,
1246
1246
  "data-list-type": e.attrs.listType,
1247
1247
  "data-spread": e.attrs.spread
@@ -1272,27 +1272,27 @@ n(M.ctx, {
1272
1272
  displayName: "NodeSchemaCtx<listItem>",
1273
1273
  group: "ListItem"
1274
1274
  });
1275
- const Oe = u(
1275
+ const Te = c(
1276
1276
  "SinkListItem",
1277
1277
  (t) => () => Rt(M.type(t))
1278
1278
  );
1279
- n(Oe, {
1279
+ n(Te, {
1280
1280
  displayName: "Command<sinkListItemCommand>",
1281
1281
  group: "ListItem"
1282
1282
  });
1283
- const Te = u(
1283
+ const Ke = c(
1284
1284
  "LiftListItem",
1285
1285
  (t) => () => rt(M.type(t))
1286
1286
  );
1287
- n(Te, {
1287
+ n(Ke, {
1288
1288
  displayName: "Command<liftListItemCommand>",
1289
1289
  group: "ListItem"
1290
1290
  });
1291
- const Ke = u(
1291
+ const De = c(
1292
1292
  "SplitListItem",
1293
- (t) => () => vt(M.type(t))
1293
+ (t) => () => Ot(M.type(t))
1294
1294
  );
1295
- n(Ke, {
1295
+ n(De, {
1296
1296
  displayName: "Command<splitListItemCommand>",
1297
1297
  group: "ListItem"
1298
1298
  });
@@ -1306,11 +1306,11 @@ function $t(t) {
1306
1306
  return i.type !== M.type(t) || i.firstChild !== l.node() || l.node(-2).childCount > 1 ? !1 : rt(M.type(t))(e, r, a);
1307
1307
  };
1308
1308
  }
1309
- const De = u(
1309
+ const ve = c(
1310
1310
  "LiftFirstListItem",
1311
1311
  (t) => () => $t(t)
1312
1312
  );
1313
- n(De, {
1313
+ n(ve, {
1314
1314
  displayName: "Command<liftFirstListItemCommand>",
1315
1315
  group: "ListItem"
1316
1316
  });
@@ -1319,28 +1319,28 @@ const _e = f("listItemKeymap", {
1319
1319
  shortcuts: "Enter",
1320
1320
  command: (t) => {
1321
1321
  const e = t.get(g);
1322
- return () => e.call(Ke.key);
1322
+ return () => e.call(De.key);
1323
1323
  }
1324
1324
  },
1325
1325
  SinkListItem: {
1326
1326
  shortcuts: ["Tab", "Mod-]"],
1327
1327
  command: (t) => {
1328
1328
  const e = t.get(g);
1329
- return () => e.call(Oe.key);
1329
+ return () => e.call(Te.key);
1330
1330
  }
1331
1331
  },
1332
1332
  LiftListItem: {
1333
1333
  shortcuts: ["Shift-Tab", "Mod-["],
1334
1334
  command: (t) => {
1335
1335
  const e = t.get(g);
1336
- return () => e.call(Te.key);
1336
+ return () => e.call(Ke.key);
1337
1337
  }
1338
1338
  },
1339
1339
  LiftFirstListItem: {
1340
1340
  shortcuts: ["Backspace", "Delete"],
1341
1341
  command: (t) => {
1342
1342
  const e = t.get(g);
1343
- return () => e.call(De.key);
1343
+ return () => e.call(ve.key);
1344
1344
  }
1345
1345
  }
1346
1346
  });
@@ -1427,7 +1427,7 @@ const qt = [
1427
1427
  me,
1428
1428
  w,
1429
1429
  z,
1430
- ue,
1430
+ ce,
1431
1431
  H,
1432
1432
  V,
1433
1433
  S,
@@ -1438,12 +1438,12 @@ const qt = [
1438
1438
  xe,
1439
1439
  F,
1440
1440
  Me,
1441
- v,
1442
- Se,
1443
1441
  O,
1444
- He,
1442
+ Se,
1445
1443
  T,
1446
- ve,
1444
+ He,
1445
+ K,
1446
+ Oe,
1447
1447
  M,
1448
1448
  ee,
1449
1449
  R,
@@ -1457,19 +1457,19 @@ const qt = [
1457
1457
  Pe,
1458
1458
  It
1459
1459
  ].flat(), Wt = [
1460
- ct,
1460
+ pt,
1461
1461
  ft,
1462
1462
  Nt,
1463
- ut,
1463
+ ct,
1464
1464
  yt,
1465
- pt
1465
+ ut
1466
1466
  ].flat(), Ft = [
1467
1467
  nt,
1468
1468
  ot,
1469
1469
  lt,
1470
1470
  st
1471
1471
  ], Vt = [
1472
- pe,
1472
+ ue,
1473
1473
  he,
1474
1474
  L,
1475
1475
  ge,
@@ -1480,10 +1480,10 @@ const qt = [
1480
1480
  kt,
1481
1481
  Be,
1482
1482
  Ae,
1483
- Oe,
1484
- Ke,
1485
1483
  Te,
1486
1484
  De,
1485
+ Ke,
1486
+ ve,
1487
1487
  te,
1488
1488
  le,
1489
1489
  ne,
@@ -1497,11 +1497,11 @@ const qt = [
1497
1497
  _e,
1498
1498
  Re,
1499
1499
  we,
1500
- ce,
1500
+ pe,
1501
1501
  re,
1502
1502
  ie,
1503
1503
  oe
1504
- ].flat(), $e = D(
1504
+ ].flat(), $e = v(
1505
1505
  "remarkAddOrderInList",
1506
1506
  () => () => (t) => {
1507
1507
  Z(t, "list", (e) => {
@@ -1522,7 +1522,7 @@ n($e.options, {
1522
1522
  displayName: "RemarkConfig<remarkAddOrderInListPlugin>",
1523
1523
  group: "Remark"
1524
1524
  });
1525
- const qe = D(
1525
+ const qe = v(
1526
1526
  "remarkLineBreak",
1527
1527
  () => () => (t) => {
1528
1528
  const e = /[\t ]*(?:\r?\n|\r)/g;
@@ -1556,9 +1556,9 @@ n(qe.options, {
1556
1556
  displayName: "RemarkConfig<remarkLineBreak>",
1557
1557
  group: "Remark"
1558
1558
  });
1559
- const We = D(
1559
+ const We = v(
1560
1560
  "remarkInlineLink",
1561
- () => Kt
1561
+ () => Dt
1562
1562
  );
1563
1563
  n(We.plugin, {
1564
1564
  displayName: "Remark<remarkInlineLinkPlugin>",
@@ -1577,10 +1577,10 @@ function zt(t, e) {
1577
1577
  for (let i = 0, d = a.children.length; i < d; i++) {
1578
1578
  const m = a.children[i];
1579
1579
  if (m) {
1580
- const p = r(m, i, a);
1581
- if (p)
1582
- for (let c = 0, k = p.length; c < k; c++) {
1583
- const C = p[c];
1580
+ const u = r(m, i, a);
1581
+ if (u)
1582
+ for (let p = 0, k = u.length; p < k; p++) {
1583
+ const C = u[p];
1584
1584
  C && l.push(C);
1585
1585
  }
1586
1586
  }
@@ -1590,7 +1590,7 @@ function zt(t, e) {
1590
1590
  return e(a, o, s);
1591
1591
  }
1592
1592
  }
1593
- const Fe = D(
1593
+ const Fe = v(
1594
1594
  "remarkHTMLTransformer",
1595
1595
  () => () => (t) => {
1596
1596
  zt(t, (e, r, a) => jt(e) ? ((a == null ? void 0 : a.type) === "root" && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]) : [e]);
@@ -1604,7 +1604,7 @@ n(Fe.options, {
1604
1604
  displayName: "RemarkConfig<remarkHtmlTransformer>",
1605
1605
  group: "Remark"
1606
1606
  });
1607
- const Ve = D(
1607
+ const Ve = v(
1608
1608
  "remarkMarker",
1609
1609
  () => () => (t, e) => {
1610
1610
  const r = (a) => e.value.charAt(a.position.start.offset);
@@ -1662,10 +1662,10 @@ const Ct = _(() => {
1662
1662
  if (r.getState(a)) {
1663
1663
  const l = a.selection.$from.pos, i = document.createElement("span"), d = ze.widget(l, i, {
1664
1664
  side: -1
1665
- }), m = document.createElement("span"), p = ze.widget(l, m);
1665
+ }), m = document.createElement("span"), u = ze.widget(l, m);
1666
1666
  return setTimeout(() => {
1667
1667
  i.contentEditable = "true", m.contentEditable = "true";
1668
- }), Je.create(a.doc, [d, p]);
1668
+ }), Je.create(a.doc, [d, u]);
1669
1669
  }
1670
1670
  return Je.empty;
1671
1671
  }
@@ -1685,7 +1685,7 @@ const Mt = _((t) => new P({
1685
1685
  if (!o) return;
1686
1686
  const [s] = o.steps;
1687
1687
  if (o.getMeta("hardbreak")) {
1688
- if (!(s instanceof Ot)) return;
1688
+ if (!(s instanceof Tt)) return;
1689
1689
  const { from: d } = s;
1690
1690
  return a.tr.setNodeMarkup(
1691
1691
  d,
@@ -1694,11 +1694,11 @@ const Mt = _((t) => new P({
1694
1694
  []
1695
1695
  );
1696
1696
  }
1697
- if (s instanceof Tt) {
1697
+ if (s instanceof Kt) {
1698
1698
  let d = a.tr;
1699
- const { from: m, to: p } = s;
1700
- return a.doc.nodesBetween(m, p, (c, k) => {
1701
- c.type === S.type(t) && (d = d.setNodeMarkup(
1699
+ const { from: m, to: u } = s;
1700
+ return a.doc.nodesBetween(m, u, (p, k) => {
1701
+ p.type === S.type(t) && (d = d.setNodeMarkup(
1702
1702
  k,
1703
1703
  S.type(t),
1704
1704
  void 0,
@@ -1750,11 +1750,11 @@ const Lt = _((t) => {
1750
1750
  a.state.doc.descendants((d, m) => {
1751
1751
  if (d.type === H.type(t)) {
1752
1752
  if (d.textContent.trim().length === 0) return;
1753
- const p = d.attrs;
1754
- let c = o(d);
1755
- i[c] ? (i[c] += 1, c += `-#${i[c]}`) : i[c] = 1, p.id !== c && (l = !0, s.setMeta(e, !0).setNodeMarkup(m, void 0, {
1756
- ...p,
1757
- id: c
1753
+ const u = d.attrs;
1754
+ let p = o(d);
1755
+ i[p] ? (i[p] += 1, p += `-#${i[p]}`) : i[p] = 1, u.id !== p && (l = !0, s.setMeta(e, !0).setNodeMarkup(m, void 0, {
1756
+ ...u,
1757
+ id: p
1758
1758
  }));
1759
1759
  }
1760
1760
  }), l && a.dispatch(s);
@@ -1775,26 +1775,26 @@ n(Lt, {
1775
1775
  const xt = _((t) => {
1776
1776
  const e = (r) => {
1777
1777
  if (r.composing || !r.editable) return;
1778
- const a = T.type(t), o = O.type(t), s = M.type(t), l = r.state, i = (p, c) => {
1778
+ const a = K.type(t), o = T.type(t), s = M.type(t), l = r.state, i = (u, p) => {
1779
1779
  let k = !1;
1780
- const C = `${c + 1}.`;
1781
- return p.label !== C && (p.label = C, k = !0), k;
1780
+ const C = `${p + 1}.`;
1781
+ return u.label !== C && (u.label = C, k = !0), k;
1782
1782
  };
1783
1783
  let d = l.tr, m = !1;
1784
- l.doc.descendants((p, c, k, C) => {
1785
- if (p.type === o) {
1786
- const y = p.maybeChild(0);
1787
- (y == null ? void 0 : y.type) === s && y.attrs.listType === "ordered" && (m = !0, d.setNodeMarkup(c, a, { spread: "true" }), p.descendants((b, Ge, Qt, St) => {
1784
+ l.doc.descendants((u, p, k, C) => {
1785
+ if (u.type === o) {
1786
+ const y = u.maybeChild(0);
1787
+ (y == null ? void 0 : y.type) === s && y.attrs.listType === "ordered" && (m = !0, d.setNodeMarkup(p, a, { spread: "true" }), u.descendants((b, Ge, Qt, St) => {
1788
1788
  if (b.type === s) {
1789
1789
  const je = { ...b.attrs };
1790
1790
  i(je, St) && (d = d.setNodeMarkup(Ge, void 0, je));
1791
1791
  }
1792
1792
  return !1;
1793
1793
  }));
1794
- } else if (p.type === s && (k == null ? void 0 : k.type) === a) {
1795
- const y = { ...p.attrs };
1794
+ } else if (u.type === s && (k == null ? void 0 : k.type) === a) {
1795
+ const y = { ...u.attrs };
1796
1796
  let b = !1;
1797
- y.listType !== "ordered" && (y.listType = "ordered", b = !0), (k == null ? void 0 : k.maybeChild(0)) && (b = i(y, C)), b && (d = d.setNodeMarkup(c, void 0, y), m = !0);
1797
+ y.listType !== "ordered" && (y.listType = "ordered", b = !0), (k == null ? void 0 : k.maybeChild(0)) && (b = i(y, C)), b && (d = d.setNodeMarkup(p, void 0, y), m = !0);
1798
1798
  }
1799
1799
  }), m && r.dispatch(d.setMeta("addToHistory", !1));
1800
1800
  };
@@ -1823,7 +1823,7 @@ const Jt = [
1823
1823
  Ve,
1824
1824
  Lt,
1825
1825
  xt
1826
- ].flat(), cr = [
1826
+ ].flat(), pr = [
1827
1827
  qt,
1828
1828
  Wt,
1829
1829
  Ft,
@@ -1837,14 +1837,14 @@ export {
1837
1837
  q as blockquoteSchema,
1838
1838
  Se as bulletListAttr,
1839
1839
  we as bulletListKeymap,
1840
- O as bulletListSchema,
1840
+ T as bulletListSchema,
1841
1841
  Ne as codeBlockAttr,
1842
1842
  Ce as codeBlockKeymap,
1843
1843
  W as codeBlockSchema,
1844
1844
  Vt as commands,
1845
- cr as commonmark,
1845
+ pr as commonmark,
1846
1846
  Ie as createCodeBlockCommand,
1847
- ut as createCodeBlockInputRule,
1847
+ ct as createCodeBlockInputRule,
1848
1848
  mt as docSchema,
1849
1849
  ge as downgradeHeadingCommand,
1850
1850
  ee as emphasisAttr,
@@ -1858,7 +1858,7 @@ export {
1858
1858
  bt as hardbreakFilterPlugin,
1859
1859
  Le as hardbreakKeymap,
1860
1860
  S as hardbreakSchema,
1861
- ue as headingAttr,
1861
+ ce as headingAttr,
1862
1862
  z as headingIdGenerator,
1863
1863
  ke as headingKeymap,
1864
1864
  H as headingSchema,
@@ -1867,7 +1867,7 @@ export {
1867
1867
  Ee as htmlAttr,
1868
1868
  Pe as htmlSchema,
1869
1869
  Me as imageAttr,
1870
- v as imageSchema,
1870
+ O as imageSchema,
1871
1871
  se as inlineCodeAttr,
1872
1872
  lt as inlineCodeInputRule,
1873
1873
  ie as inlineCodeKeymap,
@@ -1880,19 +1880,19 @@ export {
1880
1880
  gt as insertImageCommand,
1881
1881
  Pt as insertImageInputRule,
1882
1882
  Ut as keymap,
1883
- De as liftFirstListItemCommand,
1884
- Te as liftListItemCommand,
1883
+ ve as liftFirstListItemCommand,
1884
+ Ke as liftListItemCommand,
1885
1885
  de as linkAttr,
1886
1886
  B as linkSchema,
1887
- ve as listItemAttr,
1887
+ Oe as listItemAttr,
1888
1888
  _e as listItemKeymap,
1889
1889
  M as listItemSchema,
1890
1890
  Ft as markInputRules,
1891
1891
  He as orderedListAttr,
1892
1892
  Re as orderedListKeymap,
1893
- T as orderedListSchema,
1893
+ K as orderedListSchema,
1894
1894
  me as paragraphAttr,
1895
- ce as paragraphKeymap,
1895
+ pe as paragraphKeymap,
1896
1896
  w as paragraphSchema,
1897
1897
  Jt as plugins,
1898
1898
  $e as remarkAddOrderInListPlugin,
@@ -1901,8 +1901,8 @@ export {
1901
1901
  qe as remarkLineBreak,
1902
1902
  Ve as remarkMarker,
1903
1903
  qt as schema,
1904
- Oe as sinkListItemCommand,
1905
- Ke as splitListItemCommand,
1904
+ Te as sinkListItemCommand,
1905
+ De as splitListItemCommand,
1906
1906
  ae as strongAttr,
1907
1907
  st as strongInputRule,
1908
1908
  oe as strongKeymap,
@@ -1914,16 +1914,16 @@ export {
1914
1914
  le as toggleInlineCodeCommand,
1915
1915
  it as toggleLinkCommand,
1916
1916
  ne as toggleStrongCommand,
1917
- pe as turnIntoTextCommand,
1917
+ ue as turnIntoTextCommand,
1918
1918
  Et as updateCodeBlockLanguageCommand,
1919
1919
  kt as updateImageCommand,
1920
1920
  dt as updateLinkCommand,
1921
1921
  he as wrapInBlockquoteCommand,
1922
- ct as wrapInBlockquoteInputRule,
1922
+ pt as wrapInBlockquoteInputRule,
1923
1923
  Ae as wrapInBulletListCommand,
1924
1924
  ft as wrapInBulletListInputRule,
1925
1925
  L as wrapInHeadingCommand,
1926
- pt as wrapInHeadingInputRule,
1926
+ ut as wrapInHeadingInputRule,
1927
1927
  Be as wrapInOrderedListCommand,
1928
1928
  Nt as wrapInOrderedListInputRule
1929
1929
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@milkdown/preset-commonmark",
3
3
  "type": "module",
4
- "version": "7.5.9",
4
+ "version": "7.6.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -35,16 +35,16 @@
35
35
  "dependencies": {
36
36
  "@sindresorhus/slugify": "^2.2.0",
37
37
  "remark-inline-links": "^7.0.0",
38
- "tslib": "^2.5.0",
38
+ "tslib": "^2.8.1",
39
39
  "unist-util-visit": "^5.0.0",
40
- "@milkdown/exception": "7.5.9",
41
- "@milkdown/utils": "7.5.9"
40
+ "@milkdown/exception": "7.6.1",
41
+ "@milkdown/utils": "7.6.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@milkdown/core": "7.5.9",
45
- "@milkdown/ctx": "7.5.9",
46
- "@milkdown/prose": "7.5.9",
47
- "@milkdown/transformer": "7.5.9"
44
+ "@milkdown/core": "7.6.1",
45
+ "@milkdown/ctx": "7.6.1",
46
+ "@milkdown/prose": "7.6.1",
47
+ "@milkdown/transformer": "7.6.1"
48
48
  },
49
49
  "nx": {
50
50
  "targets": {