2

Is there a way to get Sphinx to generate superscripted links for footnotes that will be represented in HTML like this:

I tried:

Lorem ipsum dolor sit amet, consectetur :superscript:`1` adipiscing
elit, sed do eiusmod tempor :superscript:`[#footnote2]_`
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis

But the result is just:

Lorem ipsum dolor sit amet, consectetur 1 adipiscing elit, sed do eiusmod tempor [#footnote2]_ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis

But what I want is:

Lorem ipsum dolor sit amet, consectetur 1 adipiscing elit, sed do eiusmod tempor [4] incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis

Can this be done?

mzjn
  • 48,958
  • 13
  • 128
  • 248
latenite
  • 21
  • 2
  • Is that a link footnote you want? If so: http://www.howtobuildsoftware.com/index.php/how-do/b20n/python-sphinx-restructuredtext-printable-pdf-output-with-links-as-footnotes and https://stackoverflow.com/q/27656533/1531971 may be relevant. –  May 28 '18 at 14:31

1 Answers1

2

This is done with footnotes, and explicitly numbering the footnotes. Footnote links are automatically superscripted.

Lorem ipsum dolor sit amet, consectetur :superscript:`1` adipiscing
elit, sed do eiusmod tempor [2]_
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis

.. [2] Text of the second footnote.
stephenfin
  • 1,447
  • 3
  • 20
  • 41
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • Superscripting is theme dependent: it is true with `alabaster` and `sphinx_rtd_theme` (Read-the-docs) themes but not with `classic` or `agogo` themes for example. –  Jun 09 '18 at 22:08
  • @jfbu The rendered HTML has markup that supports superscript styling regardless of theme. `1` and `[2]` are the resulting markup snippets from above. Add custom styles to themes that lack the visual display of superscript. – Steve Piercy Jun 10 '18 at 05:45
  • Agreed, the mark-up is there and allows user customization via custom styling. It was only to point out _automatically superscripted_ does not apply out-of-the-box to all themes. –  Jun 10 '18 at 07:48