8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ mdast] [ ] extensions to parse and serialize [ GFM] [ ] autolinks .
11
+ [ mdast] [ ] extensions to parse and serialize [ GFM] [ ] autolink literals .
12
12
13
13
## Contents
14
14
19
19
* [ API] ( #api )
20
20
* [ ` gfmAutolinkLiteralFromMarkdown ` ] ( #gfmautolinkliteralfrommarkdown )
21
21
* [ ` gfmAutolinkLiteralToMarkdown ` ] ( #gfmautolinkliteraltomarkdown )
22
+ * [ HTML] ( #html )
23
+ * [ Syntax] ( #syntax )
22
24
* [ Syntax tree] ( #syntax-tree )
23
25
* [ Types] ( #types )
24
26
* [ Compatibility] ( #compatibility )
28
30
29
31
## What is this?
30
32
31
- This package contains extensions that add support for the autolink syntax
32
- enabled by GFM to [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] and
33
- [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
33
+ This package contains two extensions that add support for GFM autolink literals
34
+ syntax in markdown to [ mdast] [ ] .
35
+ These extensions plug into
36
+ [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] (to support parsing
37
+ GFM autolinks in markdown into a syntax tree) and
38
+ [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] (to support serializing
39
+ GFM autolinks in syntax trees to markdown).
34
40
35
41
GitHub employs different algorithms to autolink: one at parse time and one at
36
- transform time (similar to how @mentions are done at transform time).
42
+ transform time (similar to how ` @mentions ` are done at transform time).
37
43
This difference can be observed because character references and escapes are
38
44
handled differently.
39
45
But also because issues/PRs/comments omit (perhaps by accident?) the second
@@ -47,22 +53,30 @@ perform the second algorithm, and as they are combined, both are done.
47
53
48
54
## When to use this
49
55
50
- These tools are all rather low-level.
51
- In most cases, you’d want to use [ ` remark-gfm ` ] [ remark-gfm ] with remark instead.
56
+ You can use these extensions when you are working with
57
+ ` mdast-util-from-markdown ` and ` mdast-util-to-markdown ` already.
58
+
59
+ When working with ` mdast-util-from-markdown ` , you must combine this package
60
+ with
61
+ [ ` micromark-extension-gfm-autolink-literal ` ] [ extension ] .
62
+
63
+ When you don’t need a syntax tree, you can use [ ` micromark ` ] [ micromark ]
64
+ directly with ` micromark-extension-gfm-autolink-literal ` .
52
65
53
66
When you are working with syntax trees and want all of GFM, use
54
67
[ ` mdast-util-gfm ` ] [ mdast-util-gfm ] instead.
55
68
56
- When working with ` mdast-util-from-markdown ` , you must combine this package with
57
- [ ` micromark-extension-gfm-autolink-literal ` ] [ extension ] .
69
+ All these packages are used [ ` remark-gfm ` ] [ remark-gfm ] , which
70
+ focusses on making it easier to transform content by abstracting these
71
+ internals away.
58
72
59
73
This utility does not handle how markdown is turned to HTML.
60
74
That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
61
75
62
76
## Install
63
77
64
78
This package is [ ESM only] [ esm ] .
65
- In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
79
+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
66
80
67
81
``` sh
68
82
npm install mdast-util-gfm-autolink-literal
@@ -155,35 +169,47 @@ console.log(out)
155
169
156
170
## API
157
171
158
- This package exports the identifiers ` gfmAutolinkLiteralFromMarkdown ` and
159
- ` gfmAutolinkLiteralToMarkdown ` .
172
+ This package exports the identifiers
173
+ [ ` gfmAutolinkLiteralFromMarkdown ` ] [ api-gfmautolinkliteralfrommarkdown ] and
174
+ [ ` gfmAutolinkLiteralToMarkdown ` ] [ api-gfmautolinkliteraltomarkdown ] .
160
175
There is no default export.
161
176
162
177
### ` gfmAutolinkLiteralFromMarkdown `
163
178
164
- Extension for [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] .
179
+ Extension for [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] to enable
180
+ GFM autolink literals ([ ` FromMarkdownExtension ` ] [ frommarkdownextension ] ).
165
181
166
182
### ` gfmAutolinkLiteralToMarkdown `
167
183
168
- Extension for [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
184
+ Extension for [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] to enable
185
+ GFM autolink literals ([ ` ToMarkdownExtension ` ] [ tomarkdownextension ] ).
186
+
187
+ ## HTML
188
+
189
+ This utility does not handle how markdown is turned to HTML.
190
+ That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
191
+
192
+ ## Syntax
193
+
194
+ See [ Syntax in ` micromark-extension-gfm-autolink-literal ` ] [ syntax ] .
169
195
170
196
## Syntax tree
171
197
172
198
There are no interfaces added to ** [ mdast] [ ] ** by this utility, as it reuses
173
- the existing [ ** Link** ] [ dfn-link ] interface.
199
+ the existing ** [ Link] [ dfn-link ] ** interface.
174
200
175
201
## Types
176
202
177
203
This package is fully typed with [ TypeScript] [ ] .
178
204
It does not export additional types.
179
205
180
- The ` Link ` node type is supported in ` @types/mdast ` by default .
206
+ The ` Link ` type of the mdast nodes is exposed from ` @types/mdast ` .
181
207
182
208
## Compatibility
183
209
184
210
Projects maintained by the unified collective are compatible with all maintained
185
211
versions of Node.js.
186
- As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
212
+ As of now, that is Node.js 14.14+ and 16.0+.
187
213
Our projects sometimes work with older versions, but this is not guaranteed.
188
214
189
215
This plugin works with ` mdast-util-from-markdown ` version 1+ and
@@ -273,8 +299,20 @@ abide by its terms.
273
299
274
300
[ remark-gfm ] : https://github.com/remarkjs/remark-gfm
275
301
302
+ [ micromark ] : https://github.com/micromark/micromark
303
+
276
304
[ extension ] : https://github.com/micromark/micromark-extension-gfm-autolink-literal
277
305
306
+ [ syntax ] : https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax
307
+
278
308
[ gfm ] : https://github.github.com/gfm/
279
309
280
310
[ dfn-link ] : https://github.com/syntax-tree/mdast#link
311
+
312
+ [ frommarkdownextension ] : https://github.com/syntax-tree/mdast-util-from-markdown#extension
313
+
314
+ [ tomarkdownextension ] : https://github.com/syntax-tree/mdast-util-to-markdown#options
315
+
316
+ [ api-gfmautolinkliteralfrommarkdown ] : #gfmautolinkliteralfrommarkdown
317
+
318
+ [ api-gfmautolinkliteraltomarkdown ] : #gfmautolinkliteraltomarkdown
0 commit comments