mwilliamson / mammoth.js

Convert Word documents (.docx files) to HTML
BSD 2-Clause "Simplified" License
4.95k stars 540 forks source link

transformDocument: add class to endnote text ordered list #422

Open luukee opened 2 weeks ago

luukee commented 2 weeks ago

Hi, we are using the WordPress plugin version of Mammoth and trying to add:


Our workaround was to use the `styleMap`: 
```js
"p[style-name='endnote text'] => span.footnotes > span.footnote"

and this works, but would prefer to add the .footnotes class to the <ol> parent and .footnote class to each

  • element

    HTML output that you'd expect:

    <ol class="footnotes">
       <li class="footnote" id="post-23140-endnote-1">
            Footnote 1 text
         </li>
       <li class="footnote" id="post-23140-endnote-2">
            Footnote 2 text
         </li>
    </ol>

    Thank you for the help!

    • the operating system and version: M1 Mac OS
    • if running in the browser: Google Chrome
      • the browser and version: Version 129.0.6668.59 (Official Build) (arm64)
      • whether you get the same issue in other browsers: yes
    • if running on node.js, the version you're using: WordPress Plugin version
  • mwilliamson commented 2 weeks ago

    I'm afraid there's currently no way to control the HTML in the way you've described.