Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dcc9e6a

Browse filesBrowse files
committed
Add support for GFM footnotes
1 parent aeb53be commit dcc9e6a
Copy full SHA for dcc9e6a

File tree

Expand file treeCollapse file tree

3 files changed

+37
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+37
-0
lines changed
Open diff view settings
Collapse file

‎index.js‎

Copy file name to clipboardExpand all lines: index.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import {
99
gfmAutolinkLiteralFromMarkdown,
1010
gfmAutolinkLiteralToMarkdown
1111
} from 'mdast-util-gfm-autolink-literal'
12+
import {
13+
gfmFootnoteFromMarkdown,
14+
gfmFootnoteToMarkdown
15+
} from 'mdast-util-gfm-footnote'
1216
import {
1317
gfmStrikethroughFromMarkdown,
1418
gfmStrikethroughToMarkdown
@@ -25,6 +29,7 @@ import {
2529
export function gfmFromMarkdown() {
2630
return [
2731
gfmAutolinkLiteralFromMarkdown,
32+
gfmFootnoteFromMarkdown(),
2833
gfmStrikethroughFromMarkdown,
2934
gfmTableFromMarkdown,
3035
gfmTaskListItemFromMarkdown
@@ -39,6 +44,7 @@ export function gfmToMarkdown(options) {
3944
return {
4045
extensions: [
4146
gfmAutolinkLiteralToMarkdown,
47+
gfmFootnoteToMarkdown(),
4248
gfmStrikethroughToMarkdown,
4349
gfmTableToMarkdown(options),
4450
gfmTaskListItemToMarkdown
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
],
4141
"dependencies": {
4242
"mdast-util-gfm-autolink-literal": "^1.0.0",
43+
"mdast-util-gfm-footnote": "^1.0.0",
4344
"mdast-util-gfm-strikethrough": "^1.0.0",
4445
"mdast-util-gfm-table": "^1.0.0",
4546
"mdast-util-gfm-task-list-item": "^1.0.0"
Collapse file

‎readme.md‎

Copy file name to clipboardExpand all lines: readme.md
+30Lines changed: 30 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Alternatively, the extensions can be used separately:
2525

2626
* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal)
2727
— support GFM autolink literals
28+
* [`syntax-tree/mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote)
29+
— support GFM footnotes
2830
* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough)
2931
— support GFM strikethrough
3032
* [`syntax-tree/mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table)
@@ -54,6 +56,12 @@ Say we have the following file, `example.md`:
5456

5557
www.example.com, https://example.com, and contact@example.com.
5658

59+
## Footnote
60+
61+
A note[^1]
62+
63+
[^1]: Big note.
64+
5765
## Strikethrough
5866

5967
~one~ or ~~two~~ tildes.
@@ -130,6 +138,22 @@ Now, running `node example` yields:
130138
{type: 'text', value: '.'}
131139
]
132140
},
141+
{type: 'heading', depth: 2, children: [{type: 'text', value: 'Footnote'}]},
142+
{
143+
type: 'paragraph',
144+
children: [
145+
{type: 'text', value: 'A note'},
146+
{type: 'footnoteReference', identifier: '1', label: '1'}
147+
]
148+
},
149+
{
150+
type: 'footnoteDefinition',
151+
identifier: '1',
152+
label: '1',
153+
children: [
154+
{type: 'paragraph', children: [{type: 'text', value: 'Big note.'}]}
155+
]
156+
},
133157
{
134158
type: 'heading',
135159
depth: 2,
@@ -202,6 +226,12 @@ Now, running `node example` yields:
202226

203227
[www.example.com](http://www.example.com), <https://example.com>, and <contact@example.com>.
204228

229+
## Footnote
230+
231+
A note[^1]
232+
233+
[^1]: Big note.
234+
205235
## Strikethrough
206236

207237
~~one~~ or ~~two~~ tildes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.