Endnotes support in DOCX, ODT and markdown (via endnotes extension) #11503
Replies: 5 comments 4 replies
-
|
Endnotes support for markdown, following the conventions and syntax illustrated above, has been added in #11508. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your hard work, this has been a long requested feature for academic writers (see #1425 from 2014 and #4041 from 2017 for examples). What would happen to this if we finally get an AST change for different types of notes? |
Beta Was this translation helpful? Give feedback.
-
|
Doubts and possible flaws of this approach:
|
Beta Was this translation helpful? Give feedback.
-
|
I nearly finished the endnotes support for ODT, because it looked easier than DOCX. The writer is ready, while in the reader I currently can't figure out how to check a condition here to switch between Here's the function (lines 800-803): read_note :: InlineMatcher
read_note = matchingElement NsText "note"
$ liftA (if endnotesActive then endnote else note)
$ matchChildContent' [ read_note_body ]That function is called when an element like this (endnote) is parsed: <text:note text:id="ftn1" text:note-class="endnote">
<text:note-citation>i</text:note-citation>
<text:note-body>
<text:p text:style-name="P2">Endnote text.</text:p>
</text:note-body>
</text:note>or like this (footnote): <text:note text:id="ftn0" text:note-class="footnote">
<text:note-citation>1</text:note-citation>
<text:note-body>
<text:p text:style-name="P3">Footnote text.</text:p>
</text:note-body>
</text:note>
|
Beta Was this translation helpful? Give feedback.
-
|
@massifrg : I strongly suggest that you consider inverting the default note type with your extension: i.e. that unmarked notes should be treated as endnotes, and change the class from @massifrg wrote:
well, if endnotes and footnotes are treated alike they could break the endnotes, depending on how they are mixed together. Endnotes are usually Reference notes (i.e. bibliographic notes), so they make abundant use of "Ibid." to reference a previous reference to a same work, but if conflating footnotes and endnotes together results in a footnote ending up between the "Ibid." reference and it's previous note, then the reference is broken. In short, if all endnotes are grouped together, in their order of appearance, *after* the footnotes, then everything should be fine; but if they are all mixed together, in their order of appearance, then endnotes are likely to break. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PR #11501 provides endnotes support for docx, both in the Writer and in the Reader.
It is activated by the
endnotesextension, which is disabled by default.I'm starting this thread to collect some feedback.
Since endnotes are not in pandoc types, I'm emulating them with this convention:
Here's an example in markdown:
On the reader side, when you specify
-f docx+endnotes, you get aSpanwith classendnotearound everyNotethat comes from an endnote in the docx input file.On the writer side, when you specify
-t docx+endnotes, you get an endnote in the docx output file for everyNotethat is embedded in aSpanof classendnote.That
Spanmay have an identifier or other attributes, the condition is that it must have only one class: "endnote". The identifier and attributes will be discarded in the docx output, but maybe they could be useful for other output formats.Extending
endnotesextension to other formatsI found that putting this feature behind an extension that is disabled by default is a good way to ensure that no current workflow is going to be disrupted.
This convention could be extended to other formats as well (always disabled by default). The ones I thought of are:
\endnotemacro is already there, it should be easyEndnotes support in markdown
The example above (let's call it
test.md) has been crafted so that footnotes and endnotes are clearly distinguishable.Which is not the case when you make a roundtrip conversion like:
which gives this output:
Endnotes are still there when you export to
docx+endnotes, but the markdown source is less clear.I'd like to make the markdown format aware of the
endnotesextension, so that you could use this further convention:where
[EN1]becomes a synonym of[[EN1]]{.endnote}when the extensionendnotesis active.So when you convert with
-f markdown+endnotes, internally the AST would be the same of the first example, withSpans of classendnotearound all theNotes that in markdown have been identified with a marker that starts with a certain prefix ("EN" in this example).On the markdown writer side, the
endnotesextension would produce an output where:Please note that when the
endnotesextension is not enabled, everything still works, because all the notes are stillNotes, they are simply all footnotes, while the surroundingSpans would usually go away or be transparent in many conversions to different formats.A further choice is whether the prefix should be hardcoded or set with an option.
Beta Was this translation helpful? Give feedback.
All reactions