Skip to main content

Table Of Contents wO Tsukuru

Project description

Python

tocot

Table Of Contents wO Tsukuru

This script build a TOC for markdown

Required

Python >= 3.7

Install

pip install tocot

Usage

$ tocot --help
Usage: tocot [OPTIONS] IN_FILE OUT_FILE

Options:
  -l, --level INTEGER    [default: 2]
  -e, --to_embed TEXT    [default: [TOC]]
  --exclude_symbol TEXT  [default: exclude-toc]
  --help                 Show this message and exit.

example

You have to write "[TOC]" in your markdown file, then run below command, "[TOC]" is replaced to Table of Contents.

$ tocot README.md new_README.md
README.md
# test
これはテスト

# 目次
[TOC]

# level1
## level2
### level3
#### level4
##### level5
###### level6

## 日本語のテスト

#### level3を飛ばす

# exclude <!-- exclude-toc -->
除外されるはず

\```
# exclude
code blockの中なので無視される
\```
new_README.md
<a id="sec1-0"></a>
# test
これはテスト

<a id="sec2-0"></a>
# 目次
* [test](#sec1-0)
* [目次](#sec2-0)
* [level1](#sec3-0)
  * [level2](#sec3-1)
  * [日本語のテスト](#sec3-2)


<a id="sec3-0"></a>
# level1
<a id="sec3-1"></a>
## level2
### level3
#### level4
##### level5
###### level6

<a id="sec3-2"></a>
## 日本語のテスト

#### level3を飛ばす

# exclude <!-- exclude-toc -->
除外される

\```
# exclude
code blockの中なので無視される
\```

If you want to change "[TOC]" to "table of contents template".

$ tocot -e "table of contents template" README.md new_README.md

You can select how deep include Table of contents. Including title level is defined the number of "#".

$ tocot -l 4 README.md new_README.md

If you want to exclude title, you write comment "exclude-toc" next to the title.

$ tocot README.md new_README.md

You can change "exclude-toc" to "i hate this title".

$ tocot --exclude_symbol "i hate this title" README.md new_README.md

if you want to debug, you can write to stdout.

$ tocot README.md -

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

tocot-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

tocot-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file tocot-1.0.1.tar.gz.

File metadata

  • Download URL: tocot-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Darwin/19.6.0

File hashes

Hashes for tocot-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0974a85d0832a1a225b58612135cc4da607295d9cfc4f283ee5d6cf211fc418c
MD5 102892a0e4528747474f78e808762e8e
BLAKE2b-256 102f6d1fef5d18b6dbb237c6b87376cfd943e479e1cd56e970ba8f23279e8bf7

See more details on using hashes here.

File details

Details for the file tocot-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: tocot-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Darwin/19.6.0

File hashes

Hashes for tocot-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd19b56695ae70538ed436adc65eba076174d81dc5b8b7cf880a3b41bc3e9a23
MD5 3e14239fda5fe87ec9d2065dfc722126
BLAKE2b-256 92756e8f97432f1320e9adae20e1011967ff02ee4bf269b0a6f9509676c88977

See more details on using hashes here.

Supported by

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