Metadata-Version: 2.1
Name: marktree
Version: 1.1.1
Summary: convert headings in a Markdown file (.md) into a tree-like structure and output.
Home-page: https://github.com/yusu79/marktree
Author: yusu79
Author-email: oss@yusu79.com
License: MIT License
        
        Copyright (c) 2024 yusu79
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://yusu79.com
Project-URL: Repository, https://github.com/yusu79/marktree
Keywords: markdown,tree,pyperclip
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Other Audience
Classifier: Topic :: Terminals
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyperclip>=1.8.2
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# marktree

![GitHub License](https://img.shields.io/github/license/yusu79/marktree)
![PyPI - Version](https://img.shields.io/pypi/v/marktree)
![PyPI - Downloads](https://img.shields.io/pypi/dm/marktree)

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

## Table of Contents
- [Table of Contents](#table-of-contents)
- [Setup](#setup)
- [Quick Usage](#quick-usage)
- [Usage](#usage)
- [Dependencies](#dependencies)

## Setup
Install via pip:
```bash
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](https://yusu79.com/python-path-issue/)


## Quick Usage
```bash
$ 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`.
```md
# h1 
## h2 
### h3 
#### h4 
#### h4 
## h2 
## h2
### h3 
#### h4 
##### h5 
###### h6 
### h3
# h1 
```

- Regular output (default depth is 6):
```bash
$ marktree foo.md
├── h1 
│  ├── h2 
│  │  └── h3 
│  │     ├── h4 
│  │     └── h4 
│  ├── h2 
│  └── h2
│     ├── h3 
│     │  └── h4 
│     │     └── h5 
│     │        └── h6 
│     └── h3
└── h1 
```

- Use `-L 3` to determine the depth:
```bash
$ 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:
```bash
$ 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
- [pyperclip](https://github.com/asweigart/pyperclip)
