@milkdown/preset-commonmark 7.1.1 → 7.1.2-next.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.
- package/lib/__internal__/index.d.ts +3 -0
- package/lib/__internal__/index.d.ts.map +1 -0
- package/lib/{utils/index.d.ts → __internal__/serialize-text.d.ts} +1 -1
- package/lib/__internal__/serialize-text.d.ts.map +1 -0
- package/lib/__internal__/with-meta.d.ts +3 -0
- package/lib/__internal__/with-meta.d.ts.map +1 -0
- package/lib/index.es.js +1095 -575
- package/lib/index.es.js.map +1 -1
- package/lib/mark/emphasis.d.ts +1 -1
- package/lib/mark/emphasis.d.ts.map +1 -1
- package/lib/mark/inline-code.d.ts +1 -1
- package/lib/mark/inline-code.d.ts.map +1 -1
- package/lib/mark/link.d.ts +1 -1
- package/lib/mark/link.d.ts.map +1 -1
- package/lib/mark/strong.d.ts +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/doc.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/node/text.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/inline-sync-plugin/config.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/inline-sync-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/sync-heading-id-plugin.d.ts.map +1 -1
- package/lib/plugin/sync-list-order-plugin.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/__internal__/index.ts +3 -0
- package/src/{utils/index.ts → __internal__/serialize-text.ts} +3 -3
- package/src/__internal__/with-meta.ts +16 -0
- package/src/mark/emphasis.ts +31 -0
- package/src/mark/inline-code.ts +31 -0
- package/src/mark/link.ts +21 -0
- package/src/mark/strong.ts +31 -0
- package/src/node/blockquote.ts +36 -0
- package/src/node/bullet-list.ts +36 -0
- package/src/node/code-block.ts +41 -0
- package/src/node/doc.ts +6 -0
- package/src/node/hardbreak.ts +31 -0
- package/src/node/heading.ts +46 -1
- package/src/node/hr.ts +26 -0
- package/src/node/html.ts +16 -0
- package/src/node/image.ts +31 -0
- package/src/node/list-item.ts +41 -0
- package/src/node/ordered-list.ts +36 -0
- package/src/node/paragraph.ts +30 -1
- package/src/node/text.ts +6 -0
- package/src/plugin/hardbreak-clear-mark-plugin.ts +7 -1
- package/src/plugin/hardbreak-filter-plugin.ts +11 -0
- package/src/plugin/inline-nodes-cursor-plugin.ts +6 -0
- package/src/plugin/inline-sync-plugin/config.ts +6 -0
- package/src/plugin/inline-sync-plugin/inline-sync-plugin.ts +6 -0
- package/src/plugin/remark-add-order-in-list-plugin.ts +6 -0
- package/src/plugin/remark-html-transformer.ts +6 -0
- package/src/plugin/remark-inline-link-plugin.ts +6 -0
- package/src/plugin/remark-line-break.ts +6 -0
- package/src/plugin/sync-heading-id-plugin.ts +6 -0
- package/src/plugin/sync-list-order-plugin.ts +6 -0
- package/lib/utils/index.d.ts.map +0 -1
|
@@ -4,6 +4,7 @@ import type { Node, NodeType } from '@milkdown/prose/model'
|
|
|
4
4
|
import type { Transaction } from '@milkdown/prose/state'
|
|
5
5
|
import { $ctx } from '@milkdown/utils'
|
|
6
6
|
|
|
7
|
+
import { withMeta } from '../../__internal__'
|
|
7
8
|
import { swap } from './utils'
|
|
8
9
|
|
|
9
10
|
/// @internal
|
|
@@ -70,3 +71,8 @@ export const defaultConfig: InlineSyncConfig = {
|
|
|
70
71
|
///
|
|
71
72
|
/// You can find the default config [here](https://github.com/Milkdown/milkdown/blob/main/packages/preset-commonmark/src/plugin/inline-sync-plugin/config.ts).
|
|
72
73
|
export const inlineSyncConfig = $ctx<InlineSyncConfig, 'inlineSyncConfig'>(defaultConfig, 'inlineSyncConfig')
|
|
74
|
+
|
|
75
|
+
withMeta(inlineSyncConfig, {
|
|
76
|
+
displayName: 'Ctx<inlineSyncConfig>',
|
|
77
|
+
group: 'Prose',
|
|
78
|
+
})
|
|
@@ -4,6 +4,7 @@ import { editorViewCtx } from '@milkdown/core'
|
|
|
4
4
|
import { Plugin, PluginKey } from '@milkdown/prose/state'
|
|
5
5
|
import { $prose } from '@milkdown/utils'
|
|
6
6
|
|
|
7
|
+
import { withMeta } from '../../__internal__'
|
|
7
8
|
import { inlineSyncConfig } from './config'
|
|
8
9
|
import { getContextByState } from './context'
|
|
9
10
|
import { runReplacer } from './replacer'
|
|
@@ -66,3 +67,8 @@ export const inlineSyncPlugin = $prose((ctx: Ctx) => {
|
|
|
66
67
|
},
|
|
67
68
|
})
|
|
68
69
|
})
|
|
70
|
+
|
|
71
|
+
withMeta(inlineSyncPlugin, {
|
|
72
|
+
displayName: 'Prose<inlineSyncPlugin>',
|
|
73
|
+
group: 'Prose',
|
|
74
|
+
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { $remark } from '@milkdown/utils'
|
|
3
3
|
import type { Node, Parent } from 'unist'
|
|
4
4
|
import { visit } from 'unist-util-visit'
|
|
5
|
+
import { withMeta } from '../__internal__'
|
|
5
6
|
|
|
6
7
|
/// This plugin is used to add order in list for remark AST.
|
|
7
8
|
export const remarkAddOrderInListPlugin = $remark(() => () => (tree: Node) => {
|
|
@@ -14,3 +15,8 @@ export const remarkAddOrderInListPlugin = $remark(() => () => (tree: Node) => {
|
|
|
14
15
|
}
|
|
15
16
|
})
|
|
16
17
|
})
|
|
18
|
+
|
|
19
|
+
withMeta(remarkAddOrderInListPlugin, {
|
|
20
|
+
displayName: 'Remark<remarkAddOrderInListPlugin>',
|
|
21
|
+
group: 'Remark',
|
|
22
|
+
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
2
|
import { $remark } from '@milkdown/utils'
|
|
3
3
|
import type { Literal, Node, Parent } from 'unist'
|
|
4
|
+
import { withMeta } from '../__internal__'
|
|
4
5
|
|
|
5
6
|
const isParent = (node: Node): node is Parent => !!(node as Parent).children
|
|
6
7
|
const isHTML = (node: Node): node is Literal<string> => node.type === 'html'
|
|
@@ -47,3 +48,8 @@ export const remarkHtmlTransformer = $remark(() => () => (tree: Node) => {
|
|
|
47
48
|
return [node]
|
|
48
49
|
})
|
|
49
50
|
})
|
|
51
|
+
|
|
52
|
+
withMeta(remarkHtmlTransformer, {
|
|
53
|
+
displayName: 'Remark<remarkHtmlTransformer>',
|
|
54
|
+
group: 'Remark',
|
|
55
|
+
})
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
2
|
import { $remark } from '@milkdown/utils'
|
|
3
3
|
import remarkInlineLinks from 'remark-inline-links'
|
|
4
|
+
import { withMeta } from '../__internal__'
|
|
4
5
|
|
|
5
6
|
/// This plugin wraps [remark-inline-links](https://github.com/remarkjs/remark-inline-links).
|
|
6
7
|
export const remarkInlineLinkPlugin = $remark(() => remarkInlineLinks)
|
|
8
|
+
|
|
9
|
+
withMeta(remarkInlineLinkPlugin, {
|
|
10
|
+
displayName: 'Remark<remarkInlineLinkPlugin>',
|
|
11
|
+
group: 'Remark',
|
|
12
|
+
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { $remark } from '@milkdown/utils'
|
|
3
3
|
import type { Literal, Node, Parent } from 'unist'
|
|
4
4
|
import { visit } from 'unist-util-visit'
|
|
5
|
+
import { withMeta } from '../__internal__'
|
|
5
6
|
|
|
6
7
|
/// This plugin is used to add inline line break for remark AST.
|
|
7
8
|
/// The inline line break should be treated as a `space`.
|
|
@@ -42,3 +43,8 @@ export const remarkLineBreak = $remark(() => () => (tree: Node) => {
|
|
|
42
43
|
return index + result.length
|
|
43
44
|
})
|
|
44
45
|
})
|
|
46
|
+
|
|
47
|
+
withMeta(remarkLineBreak, {
|
|
48
|
+
displayName: 'Remark<remarkLineBreak>',
|
|
49
|
+
group: 'Remark',
|
|
50
|
+
})
|
|
@@ -3,6 +3,7 @@ import { Plugin, PluginKey } from '@milkdown/prose/state'
|
|
|
3
3
|
import type { EditorView } from '@milkdown/prose/view'
|
|
4
4
|
import { $prose } from '@milkdown/utils'
|
|
5
5
|
import { headingIdGenerator, headingSchema } from '../node/heading'
|
|
6
|
+
import { withMeta } from '../__internal__'
|
|
6
7
|
|
|
7
8
|
/// This plugin is used to sync the heading id when the heading content changes.
|
|
8
9
|
/// It will use the `headingIdGenerator` to generate the id.
|
|
@@ -53,3 +54,8 @@ export const syncHeadingIdPlugin = $prose((ctx) => {
|
|
|
53
54
|
},
|
|
54
55
|
})
|
|
55
56
|
})
|
|
57
|
+
|
|
58
|
+
withMeta(syncHeadingIdPlugin, {
|
|
59
|
+
displayName: 'Prose<syncHeadingIdPlugin>',
|
|
60
|
+
group: 'Prose',
|
|
61
|
+
})
|
|
@@ -6,6 +6,7 @@ import { listItemSchema } from '../node/list-item'
|
|
|
6
6
|
|
|
7
7
|
import { orderedListSchema } from '../node/ordered-list'
|
|
8
8
|
import { bulletListSchema } from '../node'
|
|
9
|
+
import { withMeta } from '../__internal__'
|
|
9
10
|
|
|
10
11
|
/// This plugin is used to keep the label of list item up to date in ordered list.
|
|
11
12
|
export const syncListOrderPlugin = $prose(() => {
|
|
@@ -82,3 +83,8 @@ export const syncListOrderPlugin = $prose(() => {
|
|
|
82
83
|
},
|
|
83
84
|
})
|
|
84
85
|
})
|
|
86
|
+
|
|
87
|
+
withMeta(syncListOrderPlugin, {
|
|
88
|
+
displayName: 'Prose<syncListOrderPlugin>',
|
|
89
|
+
group: 'Prose',
|
|
90
|
+
})
|
package/lib/utils/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAGjD,eAAO,MAAM,aAAa,UAAW,eAAe,QAAQ,IAAI,SAe/D,CAAA"}
|