Babysitting this morning and since they are napping, took 30 minutes to take a look at your .docx file.
- Downloaded the .docx file and opened in LibreOffice to cleanup some issues.
- Imported the docx file into calibre and converted to ePub (I have calibre set to allow extremely large files so only 3 output files.
- Opened the ePub with Sigil and ran epubcheck and epubveri. Way to many non-existent ID error, etc.
- Combined the HTML files into 1 file and used search and replace to add a Sigil split marker (<hr class="sigil_split_marker" />) before each h1.
- Split the file at the markers. This gave me 69 files.
- Removed all the IDs associated with the h1-h4 tags.
- Generated a new ToC which automatically put a sigil toc id for 2nd, etc. headers in a chapter.
- The ToC included h1-h4 and was rather large but functional.
- Regenerated the ToC using only h1. Generated a HTML ToC from that to replace the existing one.
- Regenerated the ToC using the h1-h4 headers. Generated a NCX file for ePub2 users (habit)
- Used calibre to convert the ePub to azw3. Close to 350MB due to the collection of images which ended up as a mix of png, jpeg and svg. Copied it to a Kindle PW4 and the ToC seems to work.
- Uploaded the azw3 to Google Drive. See link below.
- Need to hurry now since someone is starting their wakeup grumbling.
BOSS - python-docx.azw3
Let me know how it works for your Kindle.