New feature - Experimental support for footnotes #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CSS Generated Content for Paged Media Module WD specifies a
footnote
value for the CSSfloat
property. For now, Paged.js does not support this feature.The aim of this PR is to introduce an experimental support for footnotes. It is experimental because it relies on a hack. Fortunately, it works well with Chrome and Firefox.
The PR has two parts.
A Pandoc filter that inserts the footnotes contents in
span
s as described in example 7 of the GCPMD WD. This filter uses theblocks_to_inlines
lua
function that was recently exposed in Pandoc 2.2.3.A Paged.js hook. As far as I have tested, it works well. The idea behind this hook is to enclose each footnote
span
in a right-floating handler with 100% width before the chunker defines the pages layout.Here's an example:
With this handler, we keep a sufficient room for the footnotes on each page.
After the chunker has finished its job, the hook builds a footnote area, inserts the footnotes in this area, and finally removes the handlers from the flow.
I've tested different handlers, and the best results I have obtained is with
p
handlers.I have to admit that this hook is very dirty but this is the only trick I've found and it seems intuitive to me.
I hope you will like it!