Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

Footnotes in Gatsby

Downloads

Gatsby plugin using remark to generate footnotes with advanced grouping.

Installation

npm i gatsby-remark-reference-footnotes

Use

Generate footnotes:

[^Normal footnote]

<!-- This code block gets replaced with footnotes -->

```references

```

Generate footnotes for a specific group of footnotes:

[^:fig:Footnote for group named fig]

<!-- This code block gets replaced with footnotes for group `fig` -->

```references
group-include: fig
```

If you like to overwrite the global settings in place (camelCase or kebab-case):

<!-- This code block gets replaced with footnotes -->

```references
group-include: fig

inline-link-prefix: ' Fig. '
inline-link-suffix: '.'
inline-text-prefix: ' '
inline-text-suffix: ''

reference-link-position: end

reference-link-prefix:  ' Fig. '
reference-link-suffix:  '.⇡'
reference-text-prefix:  ' '
reference-text-suffix:  ''
```

Global Configuration

Global configurations can be set in gatsby-config.js.

module.exports = ({ root }) => ({
  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-reference-footnotes`,
            options: {
              groupInclude: "default",

              inlineLinkPrefix: "",
              inlineLinkSuffix: "",
              inlineTextPrefix: "",
              inlineTextSuffix: "",

              referenceLinkPosition: "start",

              referenceLinkPrefix: "↑ ",
              referenceLinkSuffix: ".",
              referenceTextPrefix: "",
              referenceTextSuffix: " "
            }
          }
        ]
      }
    }
  ]
});

Options

group-include

string? — default: default
If a footnote reference starts with :groupname: the output can be filtered by this group-name.

string? — default: Footnote: in link before reference number

string? — default: . Footnote: in link after reference number

reference-text-prefix

string? — default: '' Footnote: text before reference link

reference-text-suffix

string? — default: ' ' Footnote: text after reference link

string? — default: start – options: start|end Footnote-Reference: should the reference link be at the start or end

string? — default: '' Footnote-Reference: in link before inline number

string? — default: '' Footnote-Reference: in link after inline number

inline-text-prefix

string? — default: '' Footnote-Reference: text before inline link

inline-text-suffix

string? — default: '' Footnote-Reference: text after inline link

Example

Input

Text with[^test] reference footnote[^test].
Text with inline footnote[^here the inline reference].

![Cat](http://placekitten.com/g/80/120)
_This is a cat [^:fig:Reference from a different group]_

<!-- refs -->

[^test]: This is the named reference

### Footnotes

<!-- This code block gets replaced with footnotes -->

```references

```

### Figures

<!-- This code block gets replaced with footnotes -->

```references
group-include: fig
inline-link-prefix: 'Fig. '
reference-link-position: end
reference-link-prefix: ' Fig. '
reference-link-suffix: ' ⇡'
reference-text-prefix: ' '
```

Output

example output

License

MITStefan Huber

Version

  • 0.0.4 – FIX: sorting problems
© 2023 Gatsby, Inc.