mammoth.js icon indicating copy to clipboard operation
mammoth.js copied to clipboard

Footnotes and custom style maps

Open urspx opened this issue 6 years ago • 6 comments

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!

urspx avatar May 08 '18 13:05 urspx

Hello! At the moment, footnotes are unconditionally inserted into the document as you've described.

mwilliamson avatar May 08 '18 14:05 mwilliamson

would love to see that feature too

maddesigns avatar May 26 '18 10:05 maddesigns

Would love to have control on how the footnotes are being generated. Right now we can only change the contents of the list.

oninross avatar Sep 19 '18 05:09 oninross

hi there! That would be quite useful for us too! THanks!

julientaq avatar Mar 25 '22 14:03 julientaq

+1 on this feature request! 😄

theskinnyghost avatar Nov 14 '22 15:11 theskinnyghost

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>

pcraig3 avatar May 22 '24 18:05 pcraig3