Skip to main content

convert headings in a Markdown file (.md) into a tree-like structure and output.

Project description

marktree

GitHub License PyPI - Version PyPI - Downloads

This command converts headings in a Markdown file (.md) into a tree-like structure and outputs it.

Table of Contents

Setup

Install via pip:

pip install marktree

Handling the "Warning" on Windows

If you received a "Warning" when executing the above command on Windows, please refer to the following article.

Reference: Resolution for PATH not being set when using pip install in Python on Windows | Yusu Note

Quick Usage

$ marktree [Options] [foo.md]
Options Description
marktree -h Display the help screen.
marktree --help_jp Display the help screen in Japanese.
marktree -L 3 The -L option determines the level at which the tree is displayed.
marktree -C The -C option outputs the Markdown text copied to the clipboard directly in tree format.

Example

Prepare the following Markdown named foo.md.

# h1 
## h2 
### h3 
#### h4 
#### h4 
## h2 
## h2
### h3 
#### h4 
##### h5 
###### h6 
### h3
# h1 
  • Regular output (default depth is 6):
$ marktree foo.md
├── h1   ├── h2     └── h3        ├── h4        └── h4   ├── h2   └── h2
│     ├── h3        └── h4           └── h5              └── h6      └── h3
└── h1 
  • Use -L 3 to determine the depth:
$ marktree -L 3 foo.md
├── h1   ├── h2     └── h3   ├── h2   └── h2
│     ├── h3      └── h3
└── h1 
  • Use -C outputs the Markdown text copied to the clipboard directly in tree format. Additionally, -L can be used in combination:
$ marktree -C -L 3
├── h1   ├── h2     └── h3   ├── h2   └── h2
│     ├── h3      └── h3
└── h1 

Usage

The marktree command outputs the file as a tree hierarchy, depending on the # of the Markdown file. The -L option specifies the depth, as in the original tree command. Note that the depth can be from 1 to 6, and specifying more than that will result in an error. The -C option outputs the Markdown text structure copied to the clipboard directly in tree format. This is convenient as it eliminates the need to copy the Markdown text to another file before outputting.

The order of the options is in no particular order, including the Markdown file to be passed. Also, if you pass multiple files like markdown foo.md hoge.md, only the last file will be converted and output.

Dependencies

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

marktree-1.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

marktree-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file marktree-1.1.0.tar.gz.

File metadata

  • Download URL: marktree-1.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for marktree-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1087168003d0c3e5384e675a917707909639f081930b7613825cdf0274f45077
MD5 933c1f8991bceaab723adf5567e93672
BLAKE2b-256 e97e407a2805f7d6ae3991766688d500a4c44d2276481a1a33b8262c0fe5fbb9

See more details on using hashes here.

File details

Details for the file marktree-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: marktree-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for marktree-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19de1f8c27fea3c49974da2003b6b888700323d5f1740a021991151004cab726
MD5 08b1bd2d1732f5c91681065a197af44d
BLAKE2b-256 a44212c9df87006d07098854c3c1ba7d06015396f99278eb9da4f459a631ea4e

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