Skip to content

Commit 890005e

Browse files
committed
Add support for GFM footnotes
1 parent 4a5eec8 commit 890005e

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function remarkGfm(options = {}) {
1515
const data = this.data()
1616

1717
add('micromarkExtensions', gfm(options))
18-
add('fromMarkdownExtensions', gfmFromMarkdown)
18+
add('fromMarkdownExtensions', gfmFromMarkdown())
1919
add('toMarkdownExtensions', gfmToMarkdown(options))
2020

2121
/**

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
],
3838
"dependencies": {
3939
"@types/mdast": "^3.0.0",
40-
"mdast-util-gfm": "^1.0.0",
41-
"micromark-extension-gfm": "^1.0.0",
40+
"mdast-util-gfm": "^2.0.0",
41+
"micromark-extension-gfm": "^2.0.0",
4242
"unified": "^10.0.0"
4343
},
4444
"devDependencies": {

readme.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ Say we have the following file, `example.md`:
4040

4141
www.example.com, https://example.com, and [email protected].
4242

43+
## Footnote
44+
45+
A note[^1]
46+
47+
[^1]: Big note.
48+
4349
## Strikethrough
4450

4551
~one~ or ~~two~~ tildes.
@@ -80,11 +86,16 @@ unified()
8086

8187
Now, running `node example` yields:
8288

83-
```html
89+
```txt
8490
example.md: no issues found
91+
```
92+
93+
```html
8594
<h1>GFM</h1>
8695
<h2>Autolink literals</h2>
8796
<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:[email protected]">[email protected]</a>.</p>
97+
<h2>Footnote</h2>
98+
<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p>
8899
<h2>Strikethrough</h2>
89100
<p><del>one</del> or <del>two</del> tildes.</p>
90101
<h2>Table</h2>
@@ -103,6 +114,13 @@ example.md: no issues found
103114
<li class="task-list-item"><input type="checkbox" disabled> to do</li>
104115
<li class="task-list-item"><input type="checkbox" checked disabled> done</li>
105116
</ul>
117+
<section data-footnotes class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2>
118+
<ol>
119+
<li id="user-content-fn-1">
120+
<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
121+
</li>
122+
</ol>
123+
</section>
106124
```
107125

108126
## API
@@ -155,8 +173,6 @@ attacks.
155173

156174
* [`remark-github`](https://github.com/remarkjs/remark-github)
157175
— Autolink references like in GitHub issues, PRs, and comments
158-
* [`remark-footnotes`](https://github.com/remarkjs/remark-footnotes)
159-
— Footnotes
160176
* [`remark-frontmatter`](https://github.com/remarkjs/remark-frontmatter)
161177
— Frontmatter (YAML, TOML, and more)
162178
* [`remark-math`](https://github.com/remarkjs/remark-math)

0 commit comments

Comments
 (0)