Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md_contents_table-1.0.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md_contents_table-1.0.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file md_contents_table-1.0.0.tar.gz.

File metadata

  • Download URL: md_contents_table-1.0.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for md_contents_table-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2e8ec8478e0078b1bcd7e8dc34ed435dfc544e3eaa945c8379a9b7942e6a572b
MD5 12c92aa3af55adc8b3b7113ef01c7a6a
BLAKE2b-256 a95487ecf3aa72a18d04da606ceceea7bbee532a2accc1746d2da7a70df174fa

See more details on using hashes here.

File details

Details for the file md_contents_table-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for md_contents_table-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 774e079be6a85af991065aa774f4b39606dd84dc0ac80d883083328a22e59f38
MD5 598a620fbae2454c40dec5bc6e352039
BLAKE2b-256 0ae593143497d8f40a01fdd7ad83a43e6c0caee3ea68e575d79e97c434b13b1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page