Discourse footnote

Summary: The discourse footnote plugin allows you to create markdown footnotes in your posts.

image

:link: GitHub: https://github.com/discourse/discourse-footnote
:arrow_right: Install: Follow the plugin installation guide.

Features

Footnotes have been discussed as an optional CommonMark extension for a while:

The general consensus is that the extension should allow for syntax such as:

some deep thought who needs a reference[^1]

[^1]: Here's the reference. 

Discourse footnote re-packages the footnote markdown.it extension by @Vitaly as a Discourse plugin.

It supports both, single line and multi paragraph footnotes.

So, for example, this works.

We are our choices. [^sartre]

A lot of interesting words

He really said it. [^sartre]

[^sartre]: We are our choices.
Sartre, some time
some day
in the past

In a multi site environment each site can enable or disable the extension with the enable_markdown_footnotes setting.

Additionally you can either enable or disable “inline” expansion with display_footnotes_inline

Screenshots

This is how stuff looks without inline expansion:

image

This is how stuff looks with inline expansion:

image

Inline expansion is “quote” friendly and mobile friendly.

CHANGELOG

TODO

42 Likes

How can I use same footnote for different words of a topic?

For example, if I use [^1] for a word, I can’t use the same footnote for another word. It is using [1:1]. How to solve this issue?

I’m facing one more issue. If I generate Table of Contents of a topic, footnote is also displaying there. How to avoid this?

This might be a limitation of the spec. You’re seeing [1:1] because the parser is recognizing the footnote as a multi-line footnote. The second reference is being seen as the end of the block. I don’t believe this is on the roadmap to change anytime soon.

Can you share a screenshot of what you’re seeing?

3 Likes

That’s a sad thing. I believe it is an essential feature.

Pl. see the below screenshot. You can see it live at Fundamental Rule 9 - Definitions - Chapter II of Part I - Rules & Acts - PRAJA.NET

1 Like

@Johani is this behavior to be expected?

2 Likes

Generating a table of contents with headings that contain footnotes is a bit of an edge case.

The results in the screenshot above (and the link @avndp provided) are undesirable but it’s not something we can fix anytime soon.

I don’t know much about your use case @avndp, but my recommendation for now is to not use footnotes in headings in a topic that has a table of contents.

4 Likes