1
1
/**
2
2
* @typedef {import('mdast').Delete } Delete
3
+ *
3
4
* @typedef {import('mdast-util-from-markdown').CompileContext } CompileContext
4
5
* @typedef {import('mdast-util-from-markdown').Extension } FromMarkdownExtension
5
6
* @typedef {import('mdast-util-from-markdown').Handle } FromMarkdownHandle
7
+ *
6
8
* @typedef {import('mdast-util-to-markdown').ConstructName } ConstructName
7
9
* @typedef {import('mdast-util-to-markdown').Options } ToMarkdownExtension
8
10
* @typedef {import('mdast-util-to-markdown').Handle } ToMarkdownHandle
11
13
import { containerPhrasing } from 'mdast-util-to-markdown/lib/util/container-phrasing.js'
12
14
import { track } from 'mdast-util-to-markdown/lib/util/track.js'
13
15
14
- /** @type {FromMarkdownExtension } */
15
- export const gfmStrikethroughFromMarkdown = {
16
- canContainEols : [ 'delete' ] ,
17
- enter : { strikethrough : enterStrikethrough } ,
18
- exit : { strikethrough : exitStrikethrough }
19
- }
16
+ // To do: next major: expose functions.
17
+ // To do: next major: use `state`, state utilities.
20
18
21
19
/**
22
20
* List of constructs that occur in phrasing (paragraphs, headings), but cannot
23
- * contain strikethroughs. So they sort of cancel each other out.
21
+ * contain strikethrough.
22
+ * So they sort of cancel each other out.
23
+ * Note: could use a better name.
24
24
*
25
25
* Note: keep in sync with: <https://github.com/syntax-tree/mdast-util-to-markdown/blob/8ce8dbf/lib/unsafe.js#L14>
26
26
*
@@ -35,7 +35,24 @@ const constructsWithoutStrikethrough = [
35
35
'titleApostrophe'
36
36
]
37
37
38
- /** @type {ToMarkdownExtension } */
38
+ handleDelete . peek = peekDelete
39
+
40
+ /**
41
+ * Extension for `mdast-util-from-markdown` to enable GFM strikethrough.
42
+ *
43
+ * @type {FromMarkdownExtension }
44
+ */
45
+ export const gfmStrikethroughFromMarkdown = {
46
+ canContainEols : [ 'delete' ] ,
47
+ enter : { strikethrough : enterStrikethrough } ,
48
+ exit : { strikethrough : exitStrikethrough }
49
+ }
50
+
51
+ /**
52
+ * Extension for `mdast-util-to-markdown` to enable GFM strikethrough.
53
+ *
54
+ * @type {ToMarkdownExtension }
55
+ */
39
56
export const gfmStrikethroughToMarkdown = {
40
57
unsafe : [
41
58
{
@@ -47,8 +64,6 @@ export const gfmStrikethroughToMarkdown = {
47
64
handlers : { delete : handleDelete }
48
65
}
49
66
50
- handleDelete . peek = peekDelete
51
-
52
67
/**
53
68
* @this {CompileContext}
54
69
* @type {FromMarkdownHandle }
0 commit comments