CenterForOpenScience / pydocx

An extendable docx file format parser and converter
Other
183 stars 55 forks source link

Broken bookmark links #250

Closed bitscompagnie closed 6 years ago

bitscompagnie commented 6 years ago

Hello Pydocx community,

How to address broken bookmark links (anchor tags) in exported html document?

I have noticed that pydocx does not retain reference of bookmarks in exported html. I have tested several documents containing bookmarks. Pydocx only creates the anchor tags to the bookmarks but does not retain the bookmark id the anchor tags refer to.

For instance I have the attached document that I converted to html but when I click on the links referring to the bookmark locations nothing happens. From examining the source file, I noticed that no id is created during the conversion.

Here is an excerpt of exported html:

`<p style="line-height:108.0%;margin-bottom:0.67em"> Reference to bookmark one

Reference to bookmark two

<p style="line-height:108.0%;margin-bottom:0.67em">Figure 1: Chart one</p>
<p style="line-height:108.0%;margin-bottom:0.67em">Table 1 Table one</p>
<p style="line-height:108.0%;margin-bottom:0.67em">To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that
    complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then
    choose the elements you want from the different galleries.</p>
<ol class="pydocx-list-style-type-decimal">
    <li>
        <p style="line-height:108.0%">Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the
            pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings
            change to match the new theme.</p>
    </li>
    <li>
        <p style="line-height:108.0%">Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your
            document, click it and a button for layout options appears next to it. When you work on a table, click where
            you want to add a row or a column, and then click the plus sign.</p>
        <ol class="pydocx-list-style-type-lowerLetter">
            <li>
                <p style="line-height:108.0%">Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on
                    the text you want. If you need to stop reading before you reach the end, Word remembers where you
                    left off - even on another device.</p>
            </li>`

Your help will be greatly appreciated.

Thank you. bookmark_test.docx

bitscompagnie commented 6 years ago

Issue solved in pydocx-notes mixin by @botzill.