Skip to main content

md_contents_table

This module can be used to create a contents table in a markdown (.md) file.

Try:

import md_contents_table as mdCT

mdCT.CreateContentsTable("path/to/<file_name>.md")

If a contents table was previouly generated, it updates it. Text above the contents table is unaffected by updating, but also not included in the update.


Aim

Use TDD in python to develop a class that returns a string of the various headings numbered as per a contents table for an md file. For example:

# Hello
Text
## World
Other text
# Heading
## Inner Levels Reset
###### Counts Six Levels

Would re-write the file to appear as below, including # Contents and the contents table. The headings link to the relevant sections.

# Contents
1. [Hello](#hello)  
    1. [World](#world)  
2. [Heading](#heading)  
    1. [Inner Levels Reset](#inner-levels-reset)  
                        1. [Counts Six Levels](#counts-six-levels)  

# Hello
Text
~~~original file continues below~~~

Testing

Tests are run through pytest, and utilise the describe-style plugin for pytest.

pip install pytest-describe

Contact

If you have any feedback or ideas for improvement, please get in touch!
Github: https://github.com/DevDolphin7/mdContentsTable
PyPI: https://pypi.org/project/md_contents_table/
Email: DevDolphin7@outlook.com

Release files for md-contents-table 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-contents-table 1.0.0
File Size Uploaded
md_contents_table-1.0.0.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for md-contents-table 1.0.0
File Interpreter ABI Platform
md_contents_table-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.4 kB

Release files / md_contents_table-1.0.0.tar.gz

Download URL md_contents_table-1.0.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2e8ec8478e0078b1bcd7e8dc34ed435dfc544e3eaa945c8379a9b7942e6a572b
BLAKE2b-256 checksum
How to use checksums
a95487ecf3aa72a18d04da606ceceea7bbee532a2accc1746d2da7a70df174fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Release files / md_contents_table-1.0.0-py3-none-any.whl

Download URL md_contents_table-1.0.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
774e079be6a85af991065aa774f4b39606dd84dc0ac80d883083328a22e59f38
BLAKE2b-256 checksum
How to use checksums
0ae593143497d8f40a01fdd7ad83a43e6c0caee3ea68e575d79e97c434b13b1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page