create table of contents in EPUB when converting from docx [pandoc]

328 Views Asked by At

I want to automate progress of converting some EPUBs to EPUBS with toc. I first convert them to docx and by some tricks I change some paragraphs to heading 1 when I convert them again to EPUB the headings have their heading style but there is nothing in table of contents. If I create a word from scratch and use its default heading 1 pandoc easily converts that to EPUB and create TOC as it should be. Now I want a way to convert pandoc styles to something like word styles. This is my progress:


$ pandoc base.epub -o temp.docx
$ python do_magic_to_change_paragraphs_to_heading.py temp.docx # using docx package and I'm sure it's not the problem
$ pandoc temp.docx -o final.epub --toc
0

There are 0 best solutions below