Footnotes and Endnotes #85
Replies: 5 comments 13 replies
-
Footnotes are going to be an extremely important key feature for PML, so I'm really looking forward for it. I believe it should be a natively supported feature. As for how they could be implemented, I'd like to share some thoughts about it and look at how other markup syntaxes went about it. For the sake of simplicity I'll be using footnotes to indicate both footnotes and endnotes, unless otherwise specified. General ConsiderationsWhen we speak of "footnotes" we are really speaking of different types of book-notes which might coexist within a same publications:
In good academic publication you can often find all the above three types being used at once. In order to distinguish between them, independent number systems are adopted:
Ideally, PML should be able to support all three of the above, which will make it a champion syntax in terms of being up to editorial standards, especially in terms of reprinting books, where it's important to distinguish between editor notes and original notes by the author. Although its rare to find both footnotes and endnotes within a publication, it's not unheard of. When both are used it's usually the case that the former are employed for short notes which the reader might want to consult immediately, without interrupting the main reading, whereas the latter are longer notes, placed at the chapter/book end for post-reading research. I haven't yet seen any markup syntax support multiple notes types, so in order to support all of them we'd need to come up with some clever syntax device to distinguish between them and yet keep the notation concise. If supporting all three is impossible (or impractical), we should at least support two of them:
In that case, users should be able to control (1) via some setting that determines where the notes will be shown (end of page, chapter, or book), and to control which numerals to use for both (1) and (2). Footnotes SyntaxPandoc supports both in-line footnotes (i.e. the footnote text is defined within the flow of the main text) or via labels and a dedicated definition block. AsciiDoc only supports in-line definitions, but footnote definition-blocks can be simulated by externalizing footnotes. They also allow arbitrary footnote IDs, since the IDs will be replaced with ordered numbers at conversion time. This is practical since it allows footnotes to have easy to remember IDs, instead of having to look up their number. Also, it spare having to deal with renumbering the footnotes when a new footnote is added in the middle of the sequence. Pandoc Footnotes ExamplesHere is a footnote reference,[^1] and another.[^longnote]
[^1]: Here is the footnote.
[^longnote]: Here's one with multiple blocks. and this is an inline-footnote: Here is an inline note.^[Inline notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.] AsciiDoc Footnotes Examples
The hail-and-rainbow protocol can be initiated at five levels:
. doublefootnote:[The double hail-and-rainbow level makes my toes tingle.]
. tertiary
. supernumerary
. supermassive
. apocalyptic
A bold statement!footnote:disclaimer[Opinions are my own.]
Another outrageous statement.footnote:disclaimer[] Unfortunately in AsciiDoc to prevent spaces between a word and the footnote reference you have to write the word and the footnote macro side-by-side, which looks odd without a syntax highlighter: Externalizing Footnotes
AsciiDoc requires this hack to achieve what in pandoc is a natively supported feature. Document attributes have some limitations which require further hacks to enable formatting within externalized footnotes, due to how the preprocessor works, which makes this approach not so practical, especially for those who don't know AsciiDoc very well. :fn-hail-and-rainbow: footnote:[The double hail-and-rainbow level makes my toes tingle.]
:fn-disclaimer: footnote:disclaimer[Opinions are my own.]
The hail-and-rainbow protocol can be initiated at five levels:
. double{fn-hail-and-rainbow}
. tertiary
. supernumerary
. supermassive
. apocalyptic
A bold statement!{fn-disclaimer}
Another outrageous statement.{fn-disclaimer} The pandoc approach and its syntax is definitely much better than the AsciiDoc way of handling it. Footnotes ReusabilityCan a same footnote be referenced more than once within the text? and if yes, how can the backlink from the footnote to its reference within the text be handled? Usually, when footnotes are rendered in hypertext documents (HTML, PDF, etc.), the in-text footnote reference is rendered as a link pointing to the footnotes contents, and within the footnote the note number is a backlink to text where the reference is placed — but this only works if each footnote "is unique", i.e. there's a single reference for each footnote, which is why in most markup languages you can't have multiple references to a same footnote. It's quite common in real life to have a same footnote referenced multiple times in the text, e.g. a link to a specific article being mentioned in various places in a book. Ideally, one shouldn't have to create duplicate footnote entries which are identical. In good printed books a same footnote is reference multiple times, instead of having to create duplicates of the same footnote, but since the digital publishing era we're now seeing more and more publishers take the approach of creating redundant footnotes only because of editing software limitations. But I've seen examples of HTML documentation where a same footnotes is reused multiple times, and the way backlinks were handled is that within the footnote contents, next to the note number (which backlinks to the position of the first reference occurrence), additional backlinks are added in an ordered number fashion, like this:
where |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the suggestions and useful info, @coemgenuslcp and @tajmone. I will have a look at this and post a suggestion in the coming days. |
Beta Was this translation helpful? Give feedback.
-
First DraftHere are my first draft thoughts on how to add footnotes in PML. Footnotes need to be natively supported in PML, because they need special handling that cannot be achieved with scripting or user-defined-nodes. Node nameA first obvious idea would be to add nodes Node
|
Beta Was this translation helpful? Give feedback.
-
Draft 2This is the second draft, taking into account the above comments and suggestions (especially @tajmone's great idea to use a placeholder node to define the footnotes' location(s) in the final document). Inline FootnotesInline footnotes provide an easy way to define simple footnotes. Node
|
Beta Was this translation helpful? Give feedback.
-
A first version of footnotes has been added in the new public PML version 3.1.0. Inline footnotes as well as block footnotes are now implemented. For more information please visit:
The source code changes can be seen here. Feedback is very welcome. PS: I was thinking about (optionally) adding tooltips/popups to inline footnote references (displayed on mouse hovering). The content of the tooltip/popup would be the content of the footnote. This would eliminate the need to go forward and then backward to read a footnote. However, we would have to cover the case of big footnotes (including tables, etc.) - too big to be displayed as a tooltip/popup. |
Beta Was this translation helpful? Give feedback.
-
I feel like I had already posted on this last year, but maybe I just had never hit the "Start discussion" button.
How to implement footnotes, today and in the longterm? The nicest way to the user, i.e., the longterm, might be like below,
where the renderer places the footnotes at the bottom of the section or of the document, or of the page when in print view. It would handle the anchors and numbering automatically (perhaps with a config override for numbering and format options — Bible verse numbers and numbered footnotes don't go well together without adjusting one or the other visually.)
Shortterm — is that kind of dynamicity even possible yet? A UDN is simple enough to make for the content and anchors, and holding onto variables during the conversion would enable number incrementing, but I don't see how to render the footnote div in another place (bottom of the section/page) than where its definition lies in the code.
Beta Was this translation helpful? Give feedback.
All reactions