mammoth.js
mammoth.js copied to clipboard
Footnotes and custom style maps
Hello,
Thank you for the great document convertor – It's very helpful!
A question: Is it possible to use custom style maps to change how footnotes are converted? I would like to have them appear inline, wrapped in some form of tag (e.g. span.fn
). In order to do that, I tried the following:
r[style-name='FootnoteReference'] => span.fn:fresh
p[style-name='FootnoteReference'] => span.fn:fresh
p[style-name='footnote text'] => span.fn:fresh
r[style-name='footnote reference'] =>
p[style-name='Footnote'] => span.fn:fresh
r[style-name='Footnote anchor'] =>
p[style-name='footnoteReference'] => span.fn:fresh
r[style-name='footnoteReference'] =>
but it didn't have any effect; the footnotes still show up in the usual way (i.e. superscript anchors that link to ordered lists).
I'm not sure if this is relevant, but whenever I run mammoth (with or without the style map), I get the following alert:
Run style with ID FootnoteReference was referenced but not defined in the document Unrecognised run style: 'null' (Style ID: FootnoteReference)
(This is where I got those style names from).
Is there a way to disable to footnote reader? Or would this have to be done with postprocessing the html?
Thank you!
Hello! At the moment, footnotes are unconditionally inserted into the document as you've described.
would love to see that feature too
Would love to have control on how the footnotes are being generated. Right now we can only change the contents of the list.
hi there! That would be quite useful for us too! THanks!
+1 on this feature request! 😄
Has anyone figured out how to target these? I am building an application that throws exceptions on warning messages and I would like to add some rules to catch these but I am not sure if I can intercept them.
Here are the warnings I am getting (note that I am using Python but the issue is in essence the same):
Run style with ID FootnoteReference was referenced but not defined in the document Unrecognised run style: None (Style ID: FootnoteReference)
And here is what I am seeing in the XML for a footnote:
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
<w:footnoteReference w:id="2"/>
</w:r>