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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Footnote Syntax #117

Closed
wants to merge 20 commits into from
Closed

Add Footnote Syntax #117

wants to merge 20 commits into from

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Mar 11, 2020

This PR introduces footnote syntax to close #98. It also partially addresses #113 and #116

The actual Footnote and FootnoteReference markdown tokens are implemented upstream in mistletoe-ebp:

Important: As the new documentation notes, this syntax currently only supports single line footnote definitions. Multiline footnote definitions will be addressed in a later PR.

For the docutils rendering, In my test I noted that, for rST, docutils/sphinx actually seems to handle these pretty poorly;

  • not auto-collecting them into a single section at the bottom of the page,
  • not making sure the numbers are ordered, by order of reference
  • not discarding unreferenced footnotes

In the sphinx doc, they suggest putting them under a header. But I don't see that being an intuitive approach to footnotes.

Therefore, I have 'fixed' all these issues, as you can see in the test example.

tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst:

image

tests/test_sphinx/sourcedirs/footnotes/footnote_md.md:

image

New user documentation of the syntax is here:
https://272-240151150-gh.circle-artifacts.com/0/html/using/syntax.html#footnotes,
and I also improved other aspects of it; turning the syntax lists into tables: https://272-240151150-gh.circle-artifacts.com/0/html/using/syntax.html#block-tokens (I'm sure @choldgraf will appreciate 馃槃)

@mmcky @rossbar @najuzilu @akhmerov have a look at the above documentation and see what you think!

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Mar 11, 2020

The only thing that I now recall could do with improving, is the number ordering of footnote references that are in directives. The issue here is that

  1. For the standard markdown parse; the full document is read, without 'processing' roles/directives. When a new footnote reference is encountered, it is added to a global list, which later provides the numbering order.
  2. The roles/directives are now processed in a second parse, and any 'nested parsing' is undertaken. Meaning that any new footnote references encountered here will be added to the end of this global list, rather than in the actual order they occur in the document.

Instead of using this list, I probably need to do a final walk of the docutils syntax tree, and record the referencing order.

@chrisjsewell
Copy link
Member Author

The only thing that I now recall could do with improving, is the number ordering of footnote references that are in directives

Fixed 馃憤

image

@chrisjsewell chrisjsewell linked an issue Mar 11, 2020 that may be closed by this pull request
@chrisjsewell
Copy link
Member Author

rebased for merge in #119

@chrisjsewell chrisjsewell deleted the add-footnote branch July 20, 2020 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add footnote syntax? Convert most of the README to links in the documentation
1 participant