@@ -14,8 +14,10 @@ autolink literals in **[mdast][]**.
14
14
When parsing (` from-markdown ` ), must be combined with
15
15
[ ` micromark-extension-gfm-autolink-literal ` ] [ extension ] .
16
16
17
- You might want to use this package through [ ` remark-gfm ` ] [ remark-gfm ] with
18
- ** [ remark] [ ] ** .
17
+ ## When to use this
18
+
19
+ Use [ ` mdast-util-gfm ` ] [ mdast-util-gfm ] if you want all of GFM.
20
+ Use this otherwise.
19
21
20
22
## Install
21
23
@@ -30,24 +32,24 @@ npm install mdast-util-gfm-autolink-literal
30
32
31
33
## Use
32
34
33
- Say our script , ` example.js ` , looks as follows:
35
+ Say our module , ` example.js ` , looks as follows:
34
36
35
37
``` js
36
- var fromMarkdown = require ( ' mdast-util-from-markdown' )
37
- var toMarkdown = require ( ' mdast-util-to-markdown' )
38
- var syntax = require ( ' micromark-extension-gfm-autolink-literal' )
39
- var autolinkLiteral = require ( ' mdast-util-gfm-autolink-literal' )
38
+ import { fromMarkdown } from ' mdast-util-from-markdown'
39
+ import { toMarkdown } from ' mdast-util-to-markdown'
40
+ import { gfmAutolinkLiteral } from ' micromark-extension-gfm-autolink-literal'
41
+ import { gfmAutolinkLiteralFromMarkdown , gfmAutolinkLiteralToMarkdown } from ' mdast-util-gfm-autolink-literal'
40
42
41
- var doc = ' www.example.com, https://example.com, and contact@example.com.'
43
+ const doc = ' www.example.com, https://example.com, and contact@example.com.'
42
44
43
- var tree = fromMarkdown (doc, {
44
- extensions: [syntax ],
45
- mdastExtensions: [autolinkLiteral . fromMarkdown ]
45
+ const tree = fromMarkdown (doc, {
46
+ extensions: [gfmAutolinkLiteral ],
47
+ mdastExtensions: [gfmAutolinkLiteralFromMarkdown ]
46
48
})
47
49
48
50
console .log (tree)
49
51
50
- var out = toMarkdown (tree, {extensions: [autolinkLiteral . toMarkdown ]})
52
+ const out = toMarkdown (tree, {extensions: [gfmAutolinkLiteralToMarkdown ]})
51
53
52
54
console .log (out)
53
55
```
@@ -174,6 +176,8 @@ abide by its terms.
174
176
175
177
[ mdast ] : https://github.com/syntax-tree/mdast
176
178
179
+ [ mdast-util-gfm ] : https://github.com/syntax-tree/mdast-util-gfm
180
+
177
181
[ remark ] : https://github.com/remarkjs/remark
178
182
179
183
[ remark-gfm ] : https://github.com/remarkjs/remark-gfm
0 commit comments