@milkdown/preset-commonmark 7.4.0 → 7.5.8
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/__internal__/serialize-text.d.ts.map +1 -1
- package/lib/__internal__/with-meta.d.ts.map +1 -1
- package/lib/composed/commands.d.ts.map +1 -1
- package/lib/composed/inputrules.d.ts.map +1 -1
- package/lib/composed/keymap.d.ts.map +1 -1
- package/lib/composed/schema.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +544 -400
- package/lib/index.es.js.map +1 -1
- package/lib/mark/emphasis.d.ts.map +1 -1
- package/lib/mark/inline-code.d.ts.map +1 -1
- package/lib/mark/link.d.ts.map +1 -1
- package/lib/mark/strong.d.ts.map +1 -1
- package/lib/node/blockquote.d.ts.map +1 -1
- package/lib/node/bullet-list.d.ts.map +1 -1
- package/lib/node/code-block.d.ts.map +1 -1
- package/lib/node/hardbreak.d.ts.map +1 -1
- package/lib/node/heading.d.ts.map +1 -1
- package/lib/node/hr.d.ts.map +1 -1
- package/lib/node/html.d.ts.map +1 -1
- package/lib/node/image.d.ts.map +1 -1
- package/lib/node/list-item.d.ts.map +1 -1
- package/lib/node/ordered-list.d.ts.map +1 -1
- package/lib/node/paragraph.d.ts.map +1 -1
- package/lib/plugin/hardbreak-clear-mark-plugin.d.ts.map +1 -1
- package/lib/plugin/hardbreak-filter-plugin.d.ts.map +1 -1
- package/lib/plugin/inline-nodes-cursor-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-add-order-in-list-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-html-transformer.d.ts.map +1 -1
- package/lib/plugin/remark-inline-link-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-line-break.d.ts.map +1 -1
- package/lib/plugin/remark-marker-plugin.d.ts.map +1 -1
- package/lib/plugin/sync-heading-id-plugin.d.ts.map +1 -1
- package/lib/plugin/sync-list-order-plugin.d.ts.map +1 -1
- package/package.json +10 -16
- package/src/__internal__/serialize-text.ts +3 -4
- package/src/__internal__/with-meta.ts +4 -1
- package/src/composed/commands.ts +7 -1
- package/src/composed/inputrules.ts +14 -2
- package/src/composed/keymap.ts +10 -1
- package/src/composed/schema.ts +10 -1
- package/src/index.ts +16 -2
- package/src/mark/emphasis.ts +19 -9
- package/src/mark/inline-code.ts +40 -30
- package/src/mark/link.ts +55 -45
- package/src/mark/strong.ts +13 -7
- package/src/node/blockquote.ts +34 -20
- package/src/node/bullet-list.ts +20 -7
- package/src/node/code-block.ts +43 -18
- package/src/node/doc.ts +1 -1
- package/src/node/hardbreak.ts +50 -28
- package/src/node/heading.ts +44 -27
- package/src/node/hr.ts +27 -28
- package/src/node/html.ts +10 -8
- package/src/node/image.ts +57 -43
- package/src/node/list-item.ts +35 -18
- package/src/node/ordered-list.ts +31 -15
- package/src/node/paragraph.ts +10 -10
- package/src/node/text.ts +1 -1
- package/src/plugin/hardbreak-clear-mark-plugin.ts +16 -9
- package/src/plugin/hardbreak-filter-plugin.ts +5 -3
- package/src/plugin/inline-nodes-cursor-plugin.ts +13 -6
- package/src/plugin/remark-add-order-in-list-plugin.ts +13 -10
- package/src/plugin/remark-html-transformer.ts +24 -17
- package/src/plugin/remark-inline-link-plugin.ts +4 -1
- package/src/plugin/remark-line-break.ts +39 -26
- package/src/plugin/remark-marker-plugin.ts +14 -7
- package/src/plugin/sync-heading-id-plugin.ts +13 -8
- package/src/plugin/sync-list-order-plugin.ts +12 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emphasis.d.ts","sourceRoot":"","sources":["../../src/mark/emphasis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emphasis.d.ts","sourceRoot":"","sources":["../../src/mark/emphasis.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,qCAAwB,CAAA;AAQjD,eAAO,MAAM,cAAc,mDA4BxB,CAAA;AAaH,eAAO,MAAM,qBAAqB,6CAEhC,CAAA;AAQF,eAAO,MAAM,qBAAqB,sCAUhC,CAAA;AAQF,eAAO,MAAM,2BAA2B,sCAUtC,CAAA;AASF,eAAO,MAAM,cAAc,2EAQzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-code.d.ts","sourceRoot":"","sources":["../../src/mark/inline-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inline-code.d.ts","sourceRoot":"","sources":["../../src/mark/inline-code.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc,qCAA0B,CAAA;AAQrD,eAAO,MAAM,gBAAgB,qDAoB1B,CAAA;AAaH,eAAO,MAAM,uBAAuB,6CA6BnC,CAAA;AAQD,eAAO,MAAM,mBAAmB,sCAE9B,CAAA;AASF,eAAO,MAAM,gBAAgB,+EAQ3B,CAAA"}
|
package/lib/mark/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/mark/link.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,qCAAoB,CAAA;AAQzC,eAAO,MAAM,UAAU,+
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/mark/link.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,qCAAoB,CAAA;AAQzC,eAAO,MAAM,UAAU,+CAsCpB,CAAA;AAQH,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,eAAO,MAAM,iBAAiB,8DAK7B,CAAA;AASD,eAAO,MAAM,iBAAiB,8DA4C7B,CAAA"}
|
package/lib/mark/strong.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["../../src/mark/strong.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["../../src/mark/strong.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,qCAAsB,CAAA;AAQ7C,eAAO,MAAM,YAAY,iDA4BtB,CAAA;AAaH,eAAO,MAAM,mBAAmB,6CAE9B,CAAA;AAQF,eAAO,MAAM,eAAe,sCAQ1B,CAAA;AASF,eAAO,MAAM,YAAY,qEAQvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../src/node/blockquote.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../src/node/blockquote.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAWlD,eAAO,MAAM,cAAc,qCAA0B,CAAA;AAQrD,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,YAAY,CAqBtD,CAAA;AAcD,eAAO,MAAM,yBAAyB,sCAErC,CAAA;AAQD,eAAO,MAAM,uBAAuB,6CAGnC,CAAA;AASD,eAAO,MAAM,gBAAgB,+EAQ3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bullet-list.d.ts","sourceRoot":"","sources":["../../src/node/bullet-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bullet-list.d.ts","sourceRoot":"","sources":["../../src/node/bullet-list.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,qCAA0B,CAAA;AAQrD,eAAO,MAAM,gBAAgB,sDAmD3B,CAAA;AAaF,eAAO,MAAM,yBAAyB,sCAErC,CAAA;AAQD,eAAO,MAAM,uBAAuB,6CAGnC,CAAA;AASD,eAAO,MAAM,gBAAgB,+EAQ3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/node/code-block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/node/code-block.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,aAAa,qCAGvB,CAAA;AAQH,eAAO,MAAM,eAAe,qDAsD1B,CAAA;AAcF,eAAO,MAAM,wBAAwB,sCAQpC,CAAA;AASD,eAAO,MAAM,sBAAsB,6CAKlC,CAAA;AAQD,eAAO,MAAM,8BAA8B;SAIX,MAAM;cAAY,MAAM;EAavD,CAAA;AASD,eAAO,MAAM,eAAe,6EAQ1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardbreak.d.ts","sourceRoot":"","sources":["../../src/node/hardbreak.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"hardbreak.d.ts","sourceRoot":"","sources":["../../src/node/hardbreak.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,qCAKxB,CAAA;AAQF,eAAO,MAAM,eAAe,oDAsCzB,CAAA;AAaH,eAAO,MAAM,sBAAsB,6CA+BlC,CAAA;AASD,eAAO,MAAM,eAAe,6EAQ1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/node/heading.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/node/heading.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAiBjD,iBAAS,yBAAyB,CAAC,IAAI,EAAE,IAAI,UAE5C;AAID,eAAO,MAAM,kBAAkB,wFAG9B,CAAA;AAQD,eAAO,MAAM,WAAW,qCAAuB,CAAA;AAQ/C,eAAO,MAAM,aAAa,kDAkDxB,CAAA;AAcF,eAAO,MAAM,sBAAsB,sCAmBjC,CAAA;AAUF,eAAO,MAAM,oBAAoB,4CAQ/B,CAAA;AAUF,eAAO,MAAM,uBAAuB,6CAwBnC,CAAA;AAUD,eAAO,MAAM,aAAa,sKAkDxB,CAAA"}
|
package/lib/node/hr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../src/node/hr.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,qCAAkB,CAAA;AAQrC,eAAO,MAAM,QAAQ,6CAgBlB,CAAA;AAcH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../src/node/hr.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,qCAAkB,CAAA;AAQrC,eAAO,MAAM,QAAQ,6CAgBlB,CAAA;AAcH,eAAO,MAAM,iBAAiB,sCAS7B,CAAA;AAQD,eAAO,MAAM,eAAe,6CAkB3B,CAAA"}
|
package/lib/node/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/node/html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,qCAAoB,CAAA;AAOzC,eAAO,MAAM,UAAU,+
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/node/html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,qCAAoB,CAAA;AAOzC,eAAO,MAAM,UAAU,+CA2CrB,CAAA"}
|
package/lib/node/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/node/image.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,qCAAqB,CAAA;AAQ3C,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/node/image.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,qCAAqB,CAAA;AAQ3C,eAAO,MAAM,WAAW,gDAwDtB,CAAA;AAaF,MAAM,WAAW,yBAAyB;IACxC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAID,eAAO,MAAM,kBAAkB,+DAe9B,CAAA;AASD,eAAO,MAAM,kBAAkB,+DAwB9B,CAAA;AAUD,eAAO,MAAM,oBAAoB,sCAgBhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../src/node/list-item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../src/node/list-item.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,qCAAwB,CAAA;AAQjD,eAAO,MAAM,cAAc,oDA4DxB,CAAA;AAwBH,eAAO,MAAM,mBAAmB,6CAG/B,CAAA;AAmBD,eAAO,MAAM,mBAAmB,6CAG/B,CAAA;AAoBD,eAAO,MAAM,oBAAoB,6CAGhC,CAAA;AAuCD,eAAO,MAAM,wBAAwB,6CAGpC,CAAA;AAWD,eAAO,MAAM,cAAc,iIA6BzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../src/node/ordered-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../src/node/ordered-list.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,qCAA2B,CAAA;AAQvD,eAAO,MAAM,iBAAiB,uDAsD3B,CAAA;AAaH,eAAO,MAAM,0BAA0B,sCAOtC,CAAA;AAQD,eAAO,MAAM,wBAAwB,6CAGpC,CAAA;AASD,eAAO,MAAM,iBAAiB,iFAQ5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../src/node/paragraph.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,qCAAyB,CAAA;AAQnD,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../src/node/paragraph.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,qCAAyB,CAAA;AAQnD,eAAO,MAAM,eAAe,oDAuBzB,CAAA;AAYH,eAAO,MAAM,mBAAmB,6CAG/B,CAAA;AASD,eAAO,MAAM,eAAe,0EAQ1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardbreak-clear-mark-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-clear-mark-plugin.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"hardbreak-clear-mark-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-clear-mark-plugin.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB,kCA4CnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardbreak-filter-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-filter-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"hardbreak-filter-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-filter-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,kEAGhC,CAAA;AASD,eAAO,MAAM,qBAAqB,kCAsBhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-nodes-cursor-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/inline-nodes-cursor-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"inline-nodes-cursor-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/inline-nodes-cursor-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,kCA0FlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-add-order-in-list-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-add-order-in-list-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"remark-add-order-in-list-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-add-order-in-list-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B,oEAYtC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-html-transformer.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-html-transformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remark-html-transformer.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-html-transformer.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,qBAAqB,qEAejC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-inline-link-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-inline-link-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"remark-inline-link-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-inline-link-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,gEAGlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-line-break.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-line-break.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"remark-line-break.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-line-break.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,+DAgD3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-marker-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-marker-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"remark-marker-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-marker-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,4DAcxB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-heading-id-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-heading-id-plugin.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"sync-heading-id-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-heading-id-plugin.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,kCAmD9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-list-order-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-list-order-plugin.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"sync-list-order-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-list-order-plugin.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB,kCA0E9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/preset-commonmark",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.5.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/Milkdown/milkdown.git",
|
|
9
|
-
"directory": "packages/preset-commonmark"
|
|
9
|
+
"directory": "packages/plugins/preset-commonmark"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"milkdown",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"remark-inline-links": "^7.0.0",
|
|
38
38
|
"tslib": "^2.5.0",
|
|
39
39
|
"unist-util-visit": "^5.0.0",
|
|
40
|
-
"@milkdown/exception": "7.
|
|
41
|
-
"@milkdown/utils": "7.
|
|
40
|
+
"@milkdown/exception": "7.5.8",
|
|
41
|
+
"@milkdown/utils": "7.5.8"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@milkdown/core": "7.
|
|
45
|
-
"@milkdown/ctx": "7.
|
|
46
|
-
"@milkdown/prose": "7.
|
|
47
|
-
"@milkdown/transformer": "7.
|
|
44
|
+
"@milkdown/core": "7.5.8",
|
|
45
|
+
"@milkdown/ctx": "7.5.8",
|
|
46
|
+
"@milkdown/prose": "7.5.8",
|
|
47
|
+
"@milkdown/transformer": "7.5.8"
|
|
48
48
|
},
|
|
49
49
|
"nx": {
|
|
50
50
|
"targets": {
|
|
@@ -53,19 +53,13 @@
|
|
|
53
53
|
"{projectRoot}/lib"
|
|
54
54
|
],
|
|
55
55
|
"dependsOn": [
|
|
56
|
-
|
|
57
|
-
"target": "build",
|
|
58
|
-
"projects": "dependencies"
|
|
59
|
-
}
|
|
56
|
+
"build"
|
|
60
57
|
]
|
|
61
58
|
},
|
|
62
59
|
"tsc": {
|
|
63
60
|
"outputs": [],
|
|
64
61
|
"dependsOn": [
|
|
65
|
-
|
|
66
|
-
"target": "build",
|
|
67
|
-
"projects": "dependencies"
|
|
68
|
-
}
|
|
62
|
+
"build"
|
|
69
63
|
]
|
|
70
64
|
}
|
|
71
65
|
}
|
|
@@ -3,8 +3,8 @@ import type { Node } from '@milkdown/prose/model'
|
|
|
3
3
|
import { Fragment } from '@milkdown/prose/model'
|
|
4
4
|
|
|
5
5
|
export function serializeText(state: SerializerState, node: Node) {
|
|
6
|
-
const lastIsHardBreak
|
|
7
|
-
|
|
6
|
+
const lastIsHardBreak =
|
|
7
|
+
node.childCount >= 1 && node.lastChild?.type.name === 'hardbreak'
|
|
8
8
|
if (!lastIsHardBreak) {
|
|
9
9
|
state.next(node.content)
|
|
10
10
|
return
|
|
@@ -12,8 +12,7 @@ export function serializeText(state: SerializerState, node: Node) {
|
|
|
12
12
|
|
|
13
13
|
const contentArr: Node[] = []
|
|
14
14
|
node.content.forEach((n, _, i) => {
|
|
15
|
-
if (i === node.childCount - 1)
|
|
16
|
-
return
|
|
15
|
+
if (i === node.childCount - 1) return
|
|
17
16
|
|
|
18
17
|
contentArr.push(n)
|
|
19
18
|
})
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Meta, MilkdownPlugin } from '@milkdown/ctx'
|
|
2
2
|
|
|
3
|
-
export function withMeta<T extends MilkdownPlugin>(
|
|
3
|
+
export function withMeta<T extends MilkdownPlugin>(
|
|
4
|
+
plugin: T,
|
|
5
|
+
meta: Partial<Meta> & Pick<Meta, 'displayName'>
|
|
6
|
+
): T {
|
|
4
7
|
Object.assign(plugin, {
|
|
5
8
|
meta: {
|
|
6
9
|
package: '@milkdown/preset-commonmark',
|
package/src/composed/commands.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
toggleEmphasisCommand,
|
|
4
|
+
toggleInlineCodeCommand,
|
|
5
|
+
toggleLinkCommand,
|
|
6
|
+
toggleStrongCommand,
|
|
7
|
+
updateLinkCommand,
|
|
8
|
+
} from '../mark'
|
|
3
9
|
import {
|
|
4
10
|
createCodeBlockCommand,
|
|
5
11
|
downgradeHeadingCommand,
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
createCodeBlockInputRule,
|
|
4
|
+
insertHrInputRule,
|
|
5
|
+
wrapInBlockquoteInputRule,
|
|
6
|
+
wrapInBulletListInputRule,
|
|
7
|
+
wrapInHeadingInputRule,
|
|
8
|
+
wrapInOrderedListInputRule,
|
|
9
|
+
} from '../node'
|
|
10
|
+
import {
|
|
11
|
+
emphasisStarInputRule,
|
|
12
|
+
emphasisUnderscoreInputRule,
|
|
13
|
+
inlineCodeInputRule,
|
|
14
|
+
strongInputRule,
|
|
15
|
+
} from '../mark'
|
|
4
16
|
|
|
5
17
|
/// @internal
|
|
6
18
|
export const inputRules: MilkdownPlugin[] = [
|
package/src/composed/keymap.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
2
2
|
import { emphasisKeymap, inlineCodeKeymap, strongKeymap } from '../mark'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
blockquoteKeymap,
|
|
5
|
+
bulletListKeymap,
|
|
6
|
+
codeBlockKeymap,
|
|
7
|
+
hardbreakKeymap,
|
|
8
|
+
headingKeymap,
|
|
9
|
+
listItemKeymap,
|
|
10
|
+
orderedListKeymap,
|
|
11
|
+
paragraphKeymap,
|
|
12
|
+
} from '../node'
|
|
4
13
|
|
|
5
14
|
/// @internal
|
|
6
15
|
export const keymap: MilkdownPlugin[] = [
|
package/src/composed/schema.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
emphasisAttr,
|
|
4
|
+
emphasisSchema,
|
|
5
|
+
inlineCodeAttr,
|
|
6
|
+
inlineCodeSchema,
|
|
7
|
+
linkAttr,
|
|
8
|
+
linkSchema,
|
|
9
|
+
strongAttr,
|
|
10
|
+
strongSchema,
|
|
11
|
+
} from '../mark'
|
|
3
12
|
import {
|
|
4
13
|
blockquoteAttr,
|
|
5
14
|
blockquoteSchema,
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
commands,
|
|
4
|
+
inputRules,
|
|
5
|
+
keymap,
|
|
6
|
+
markInputRules,
|
|
7
|
+
plugins,
|
|
8
|
+
schema,
|
|
9
|
+
} from './composed'
|
|
3
10
|
|
|
4
11
|
export * from './node'
|
|
5
12
|
export * from './mark'
|
|
@@ -7,4 +14,11 @@ export * from './plugin'
|
|
|
7
14
|
export * from './composed'
|
|
8
15
|
|
|
9
16
|
/// The commonmark preset, includes all the plugins.
|
|
10
|
-
export const commonmark: MilkdownPlugin[] = [
|
|
17
|
+
export const commonmark: MilkdownPlugin[] = [
|
|
18
|
+
schema,
|
|
19
|
+
inputRules,
|
|
20
|
+
markInputRules,
|
|
21
|
+
commands,
|
|
22
|
+
keymap,
|
|
23
|
+
plugins,
|
|
24
|
+
].flat()
|
package/src/mark/emphasis.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { commandsCtx, remarkStringifyOptionsCtx } from '@milkdown/core'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$command,
|
|
4
|
+
$inputRule,
|
|
5
|
+
$markAttr,
|
|
6
|
+
$markSchema,
|
|
7
|
+
$useKeymap,
|
|
8
|
+
} from '@milkdown/utils'
|
|
3
9
|
import { toggleMark } from '@milkdown/prose/commands'
|
|
4
10
|
import { markRule } from '@milkdown/prose'
|
|
5
11
|
import { withMeta } from '../__internal__'
|
|
@@ -13,7 +19,7 @@ withMeta(emphasisAttr, {
|
|
|
13
19
|
})
|
|
14
20
|
|
|
15
21
|
/// Emphasis mark schema.
|
|
16
|
-
export const emphasisSchema = $markSchema('emphasis', ctx => ({
|
|
22
|
+
export const emphasisSchema = $markSchema('emphasis', (ctx) => ({
|
|
17
23
|
attrs: {
|
|
18
24
|
marker: {
|
|
19
25
|
default: ctx.get(remarkStringifyOptionsCtx).emphasis || '*',
|
|
@@ -22,11 +28,11 @@ export const emphasisSchema = $markSchema('emphasis', ctx => ({
|
|
|
22
28
|
parseDOM: [
|
|
23
29
|
{ tag: 'i' },
|
|
24
30
|
{ tag: 'em' },
|
|
25
|
-
{ style: 'font-style', getAttrs: value => (value === 'italic') as false },
|
|
31
|
+
{ style: 'font-style', getAttrs: (value) => (value === 'italic') as false },
|
|
26
32
|
],
|
|
27
|
-
toDOM: mark => ['em', ctx.get(emphasisAttr.key)(mark)],
|
|
33
|
+
toDOM: (mark) => ['em', ctx.get(emphasisAttr.key)(mark)],
|
|
28
34
|
parseMarkdown: {
|
|
29
|
-
match: node => node.type === 'emphasis',
|
|
35
|
+
match: (node) => node.type === 'emphasis',
|
|
30
36
|
runner: (state, node, markType) => {
|
|
31
37
|
state.openMark(markType, { marker: node.marker })
|
|
32
38
|
state.next(node.children)
|
|
@@ -34,7 +40,7 @@ export const emphasisSchema = $markSchema('emphasis', ctx => ({
|
|
|
34
40
|
},
|
|
35
41
|
},
|
|
36
42
|
toMarkdown: {
|
|
37
|
-
match: mark => mark.type.name === 'emphasis',
|
|
43
|
+
match: (mark) => mark.type.name === 'emphasis',
|
|
38
44
|
runner: (state, mark) => {
|
|
39
45
|
state.withMark(mark, 'emphasis', undefined, {
|
|
40
46
|
marker: mark.attrs.marker,
|
|
@@ -54,7 +60,7 @@ withMeta(emphasisSchema.ctx, {
|
|
|
54
60
|
})
|
|
55
61
|
|
|
56
62
|
/// A command to toggle the emphasis mark.
|
|
57
|
-
export const toggleEmphasisCommand = $command('ToggleEmphasis', ctx => () => {
|
|
63
|
+
export const toggleEmphasisCommand = $command('ToggleEmphasis', (ctx) => () => {
|
|
58
64
|
return toggleMark(emphasisSchema.type(ctx))
|
|
59
65
|
})
|
|
60
66
|
|
|
@@ -70,7 +76,9 @@ export const emphasisStarInputRule = $inputRule((ctx) => {
|
|
|
70
76
|
marker: '*',
|
|
71
77
|
}),
|
|
72
78
|
updateCaptured: ({ fullMatch, start }) =>
|
|
73
|
-
!fullMatch.startsWith('*')
|
|
79
|
+
!fullMatch.startsWith('*')
|
|
80
|
+
? { fullMatch: fullMatch.slice(1), start: start + 1 }
|
|
81
|
+
: {},
|
|
74
82
|
})
|
|
75
83
|
})
|
|
76
84
|
|
|
@@ -86,7 +94,9 @@ export const emphasisUnderscoreInputRule = $inputRule((ctx) => {
|
|
|
86
94
|
marker: '_',
|
|
87
95
|
}),
|
|
88
96
|
updateCaptured: ({ fullMatch, start }) =>
|
|
89
|
-
!fullMatch.startsWith('_')
|
|
97
|
+
!fullMatch.startsWith('_')
|
|
98
|
+
? { fullMatch: fullMatch.slice(1), start: start + 1 }
|
|
99
|
+
: {},
|
|
90
100
|
})
|
|
91
101
|
})
|
|
92
102
|
|
package/src/mark/inline-code.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { commandsCtx } from '@milkdown/core'
|
|
2
2
|
import type { MarkType } from '@milkdown/prose/model'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
$command,
|
|
5
|
+
$inputRule,
|
|
6
|
+
$markAttr,
|
|
7
|
+
$markSchema,
|
|
8
|
+
$useKeymap,
|
|
9
|
+
} from '@milkdown/utils'
|
|
4
10
|
import { markRule } from '@milkdown/prose'
|
|
5
11
|
import { withMeta } from '../__internal__'
|
|
6
12
|
|
|
@@ -13,14 +19,14 @@ withMeta(inlineCodeAttr, {
|
|
|
13
19
|
})
|
|
14
20
|
|
|
15
21
|
/// InlineCode mark schema.
|
|
16
|
-
export const inlineCodeSchema = $markSchema('inlineCode', ctx => ({
|
|
22
|
+
export const inlineCodeSchema = $markSchema('inlineCode', (ctx) => ({
|
|
17
23
|
priority: 100,
|
|
18
24
|
code: true,
|
|
19
25
|
inclusive: false,
|
|
20
26
|
parseDOM: [{ tag: 'code' }],
|
|
21
|
-
toDOM: mark => ['code', ctx.get(inlineCodeAttr.key)(mark)],
|
|
27
|
+
toDOM: (mark) => ['code', ctx.get(inlineCodeAttr.key)(mark)],
|
|
22
28
|
parseMarkdown: {
|
|
23
|
-
match: node => node.type === 'inlineCode',
|
|
29
|
+
match: (node) => node.type === 'inlineCode',
|
|
24
30
|
runner: (state, node, markType) => {
|
|
25
31
|
state.openMark(markType)
|
|
26
32
|
state.addText(node.value as string)
|
|
@@ -28,7 +34,7 @@ export const inlineCodeSchema = $markSchema('inlineCode', ctx => ({
|
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
36
|
toMarkdown: {
|
|
31
|
-
match: mark => mark.type.name === 'inlineCode',
|
|
37
|
+
match: (mark) => mark.type.name === 'inlineCode',
|
|
32
38
|
runner: (state, mark, node) => {
|
|
33
39
|
state.withMark(mark, 'inlineCode', node.text || '')
|
|
34
40
|
},
|
|
@@ -46,32 +52,36 @@ withMeta(inlineCodeSchema.ctx, {
|
|
|
46
52
|
})
|
|
47
53
|
|
|
48
54
|
/// A command to toggle the inlineCode mark.
|
|
49
|
-
export const toggleInlineCodeCommand = $command(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
export const toggleInlineCodeCommand = $command(
|
|
56
|
+
'ToggleInlineCode',
|
|
57
|
+
(ctx) => () => (state, dispatch) => {
|
|
58
|
+
const { selection, tr } = state
|
|
59
|
+
if (selection.empty) return false
|
|
60
|
+
const { from, to } = selection
|
|
61
|
+
|
|
62
|
+
const has = state.doc.rangeHasMark(from, to, inlineCodeSchema.type(ctx))
|
|
63
|
+
// remove exists inlineCode mark if have
|
|
64
|
+
if (has) {
|
|
65
|
+
dispatch?.(tr.removeMark(from, to, inlineCodeSchema.type(ctx)))
|
|
66
|
+
return true
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const restMarksName = Object.keys(state.schema.marks).filter(
|
|
70
|
+
(x) => x !== inlineCodeSchema.type.name
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
// remove other marks
|
|
74
|
+
restMarksName
|
|
75
|
+
.map((name) => state.schema.marks[name] as MarkType)
|
|
76
|
+
.forEach((t) => {
|
|
77
|
+
tr.removeMark(from, to, t)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// add inlineCode mark
|
|
81
|
+
dispatch?.(tr.addMark(from, to, inlineCodeSchema.type(ctx).create()))
|
|
59
82
|
return true
|
|
60
83
|
}
|
|
61
|
-
|
|
62
|
-
const restMarksName = Object.keys(state.schema.marks).filter(x => x !== inlineCodeSchema.type.name)
|
|
63
|
-
|
|
64
|
-
// remove other marks
|
|
65
|
-
restMarksName
|
|
66
|
-
.map(name => state.schema.marks[name] as MarkType)
|
|
67
|
-
.forEach((t) => {
|
|
68
|
-
tr.removeMark(from, to, t)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
// add inlineCode mark
|
|
72
|
-
dispatch?.(tr.addMark(from, to, inlineCodeSchema.type(ctx).create()))
|
|
73
|
-
return true
|
|
74
|
-
})
|
|
84
|
+
)
|
|
75
85
|
|
|
76
86
|
withMeta(toggleInlineCodeCommand, {
|
|
77
87
|
displayName: 'Command<toggleInlineCodeCommand>',
|
|
@@ -80,7 +90,7 @@ withMeta(toggleInlineCodeCommand, {
|
|
|
80
90
|
|
|
81
91
|
/// Input rule for create inlineCode mark.
|
|
82
92
|
export const inlineCodeInputRule = $inputRule((ctx) => {
|
|
83
|
-
return markRule(/(
|
|
93
|
+
return markRule(/(?:`)([^`]+)(?:`)$/, inlineCodeSchema.type(ctx))
|
|
84
94
|
})
|
|
85
95
|
|
|
86
96
|
withMeta(inlineCodeInputRule, {
|