简体   繁体   中英

Create a dynamic table of contents with page numbers in HTML

I have a python script that converts a MarkDown text to HTML (with some additions and styling of my own), The markdown code includes headers and bookmarks, I want the script to automatically create a table of contents that would include the page numbers (like you might find in a printed book for example) based on the assumption that the document would be printed on standard A4 sheets. Is it possible?

Thanks...
YK

Why not use .rst or .md files with sphinx ? You can have a table of contents and it will generate your html and you can do all kinds of fancy stuff with it. An overwhelming majority of python documentation is written using it. It looks like they account for A4 paper size as well in some cases.

From the sphinx docs environment variables section :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM