Sitelet https://github.com/python/cpython/issues/137742
Skip to content

Use footnotes for numbered notes in tables #137742

Description

@brianschubert

Documentation

In a few places, the docs include tables with numbered notes, similar to this:

Cheese In Stock
Red Leicester no
Camembert yes (1) (2)

(1) it's a bit runny
(2) the cat's eaten it

Often the notes are written using simple numbered lists, which notably don't create links between the note references and their definitions. This can make viewing the notes somewhat tedious, particularly when the table is very long or when the same notes are shared by multiple tables.

Another way to format these notes is using Sphinx footnotes. Footnotes have the benefit of creating bi-directional links between the note entries and their references, which makes viewing a note and then navigating back to where you were much easier. The footnote definitions can be placed anywhere in the docs, so in particular they can be placed immediately after the table that references them. This is already done for a few tables in the current docs, e.g. in collections.abc.

I propose migrating some of the existing table notes to footnotes in cases where having the extra navigation links would be helpful. In particular, I think this would be useful for the format code tables in the datetime docs.

The result would look something like this:

Cheese In Stock
Red Leicester no
Camembert yes 1 2

Linked PRs

Footnotes

  1. it's a bit runny ↩

  2. the cat's eaten it ↩

Activity

  1. terryjreedy commented on Aug 14, 2025

    @terryjreedy
    Member
    1. The formatting of the footnotes and links above is a bit different than it would be in the docs. See collections.abc link above. In the note list, number is backlinks, unless there are multiple backlinks. In the latter case, the note # is followed by backlinked number, as in [1](1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) These ABCs override ... in the example.
      2 A slight downside given multiple tables with footnote is that footnotes are numbered 1,2,3,... throughout the whole file instead of restarting with 1 for each table. The example file does not have another table. The preview for the PR file has 3. I think people can adjust.
  2. encukou commented on Feb 5, 2026

    @encukou
    Member

    I wonder if we should use named notes instead, with little identifier-like mnemonics; something like:

    Cheese In Stock
    Red Leicester No.
    Camembert Yes. [runny, cat]

    Notes:
    [runny]: it's a bit runny
    [cat]: the cat's eaten it

    That would certainly help me match the entries with the content when reading :)

    Regular links don't have the backlinks, but I guess that's OK?

    Sphinx citations render a like this, but aren't the correct element to use.

  3. StanFromIreland commented on Feb 6, 2026

    @StanFromIreland
    Member

    (My comment is specifically for the datetime case)

    little identifier-like mnemonics

    I don't think these are the best here. Mnemonics have a similar issue as the footnotes for the whole file, although rather than changing the numbering (which I would like to preserve) we remove it entirely. I also think it is quite hard to come up with a single word to match some of the notes. And, lastly, the format code table is already quite width constricted, and with some rows having two notes, words would take up space we don't have.

    The other tables in the file are shorter than the format code one, what if we only add the footnotes for the last table (which I would assume is most-read), preserving the numbering? We could then use Petr's mnemonics idea for the shorter (and wider, as we have less columns) tables.

  4. encukou commented on Feb 9, 2026

    @encukou
    Member

    Other tables are two-column “operation” & “its result” tables; these might be better presented as definition lists or .. describe:: entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions