Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering of footnote #2409

Open
harryhanYuhao opened this issue Jul 1, 2024 · 1 comment
Open

Ordering of footnote #2409

harryhanYuhao opened this issue Jul 1, 2024 · 1 comment
Labels
A-footnotes Area: footnotes C-enhancement Category: Enhancement or feature request

Comments

@harryhanYuhao
Copy link

harryhanYuhao commented Jul 1, 2024

Problem

Currently the footnotes are numbered by their first reference in text, instead of the actual order of the footnote in the end.

For example

aha[^note], that is right[^another_note]

[^another_note]: right
[^note]: aha

Will be rendered to something like

aha^1, that is right^2

2 right
1 aha

Notice the footnote numbered as 2 is placed first.
This is both unnatural and non-customary.

The customary style which is used by most journals is to number the footnotes in the order they are presented at the end.

aha[^note], that is right[^another_note]

[^another_note]: right
[^note]: aha

shall produce

aha^2, that is right^1

1 right
2: aha

Proposed Solution

Number the footnotes by their orders at the end, as most journals do.

Notes

No response

@harryhanYuhao harryhanYuhao added the C-enhancement Category: Enhancement or feature request label Jul 1, 2024
@ehuss ehuss added the A-footnotes Area: footnotes label Jul 8, 2024
@chriskrycho
Copy link

The latest version of pulldown-cmark (0.11) supports this, although it requires doing a bit of rewriting of the event stream. The example linked there is pretty well-commented! To make it work in mdbook, you would probably need to change the new_cmark_parser API. It and the output from its neighbors render_markdown and render_markdown_with_path are public API, and this would also substantially change their output, so this would need to either be a breaking change or an additional option.

Related: #2401, which would also enable a more standard form of footnote parsing (you can fix the rendering with the old or the new parsing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-footnotes Area: footnotes C-enhancement Category: Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

3 participants