Skip to content

Commit

Permalink
Add support for GFM footnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 3, 2021
1 parent 4a5eec8 commit 890005e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function remarkGfm(options = {}) {
const data = this.data()

add('micromarkExtensions', gfm(options))
add('fromMarkdownExtensions', gfmFromMarkdown)
add('fromMarkdownExtensions', gfmFromMarkdown())
add('toMarkdownExtensions', gfmToMarkdown(options))

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
],
"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-util-gfm": "^1.0.0",
"micromark-extension-gfm": "^1.0.0",
"mdast-util-gfm": "^2.0.0",
"micromark-extension-gfm": "^2.0.0",
"unified": "^10.0.0"
},
"devDependencies": {
Expand Down
22 changes: 19 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ Say we have the following file, `example.md`:

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

## Footnote

A note[^1]

[^1]: Big note.

## Strikethrough

~one~ or ~~two~~ tildes.
Expand Down Expand Up @@ -80,11 +86,16 @@ unified()

Now, running `node example` yields:

```html
```txt
example.md: no issues found
```

```html
<h1>GFM</h1>
<h2>Autolink literals</h2>
<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>
<h2>Footnote</h2>
<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>
<h2>Strikethrough</h2>
<p><del>one</del> or <del>two</del> tildes.</p>
<h2>Table</h2>
Expand All @@ -103,6 +114,13 @@ example.md: no issues found
<li class="task-list-item"><input type="checkbox" disabled> to do</li>
<li class="task-list-item"><input type="checkbox" checked disabled> done</li>
</ul>
<section data-footnotes class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
</li>
</ol>
</section>
```

## API
Expand Down Expand Up @@ -155,8 +173,6 @@ attacks.

* [`remark-github`](https://github.com/remarkjs/remark-github)
— Autolink references like in GitHub issues, PRs, and comments
* [`remark-footnotes`](https://github.com/remarkjs/remark-footnotes)
— Footnotes
* [`remark-frontmatter`](https://github.com/remarkjs/remark-frontmatter)
— Frontmatter (YAML, TOML, and more)
* [`remark-math`](https://github.com/remarkjs/remark-math)
Expand Down

0 comments on commit 890005e

Please sign in to comment.