Skip to main content

marktree

GitHub License PyPI - Version PyPI - Downloads

A CLI tool that displays the headings of a Markdown (.md) file as a tree structure.

Features

  • Display Markdown heading hierarchy as a tree
  • Limit the maximum heading level
  • Output headings as plain text
  • Read Markdown directly from the clipboard
  • Copy the generated result to the clipboard
  • Support UTF-8, CP932, Shift_JIS and other encodings

Japanese README

https://github.com/yusu79/marktree/blob/main/README.md

Table of Contents

Installation

pip install marktree

Quick Start

Markdown file:

# h1

## h2

### h3

## h2

# h1

Run:

marktree sample.md

Output:

├── h1
│  ├── h2
│  │  └── h3
│  └── h2
└── h1

Options

Command Description
marktree -h Show help
marktree -L 3 file.md Limit the maximum heading level
marktree -C Read Markdown from the clipboard
marktree -P file.md Output headings as plain text
marktree -E cp932 file.md Specify the file encoding
marktree --copy file.md Copy the result to the clipboard

Examples

Default Output

marktree sample.md
├── h1
│  ├── h2
│  │  └── h3
│  └── h2
└── h1

Limit the Heading Level

marktree -L 2 sample.md
├── h1
│  ├── h2
│  └── h2
└── h1

Read from the Clipboard

Reads the Markdown text currently stored in the clipboard.

marktree -C

You can combine it with the -L option.

marktree -C -L 3

Output Headings Only

marktree -P sample.md

Output:

# h1
## h2
### h3
## h2
# h1

Copy the Result to the Clipboard

Copies the generated tree to the clipboard instead of printing it to standard output.

marktree sample.md --copy

Specify the File Encoding

marktree -E cp932 sample.md

Supported examples:

  • utf-8
  • cp932
  • shift_jis

Option Details

-L

Displays headings up to the specified level. Valid values are 1–6 (default: 6).

-C

Uses the Markdown text currently stored in the clipboard as input.

This allows you to view the heading structure without saving the text to a file.

-P

Outputs only the headings without tree formatting.

-E

Specifies the file encoding, for example:

marktree -E cp932 sample.md

--copy

Copies the generated output to the clipboard instead of printing it to standard output.

Option Order

Options can be specified in any order.

marktree -L 3 sample.md
marktree sample.md -L 3

If multiple Markdown files are specified, only the last one is processed.

Windows Installation Warnings

If you see:

WARNING: The script xxx.exe is installed in '...' which is not on PATH.

See:

https://yusu79.com/python-path-issue/

If you see:

WARNING: Failed to write executable - trying to use .deleteme logic

See:

https://yusu79.com/pip-install-failure-fix/

Dependencies

Development Diary

https://yusu79.com/dev-marktree/

Metadata

Release files for marktree 1.3.1

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

Source distribution (sdist)

Source distribution for marktree 1.3.1
File Size Uploaded Provenance Actions
marktree-1.3.1.tar.gz 7.1 kB Without provenance Details for marktree-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marktree 1.3.1
File Interpreter ABI Platform Actions
marktree-1.3.1-py3-none-any.whl Python 3 none any Details for marktree-1.3.1-py3-none-any.whl

Total release size: 16.3 kB

Release files / marktree-1.3.1.tar.gz

Download URL marktree-1.3.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bbd9769f66ab63328e1ad117acd298dfc9d19330460cd76ee78481d3514603cc
BLAKE2b-256 checksum
How to use checksums
f3c44ca3572c4f1a935b1499b4b3fb808594f80bdfa815e09b4a681251ce6dc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.14.5 Windows/11

Release files / marktree-1.3.1-py3-none-any.whl

Download URL marktree-1.3.1-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41d0a1514e999912b1d303fd03f0fd77f738a9247a5e73648de936b477327788
BLAKE2b-256 checksum
How to use checksums
7c00b68c7862d96dc289971dd01ab7ef6686ff93317b9a932543ba9163966716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.14.5 Windows/11

Security for marktree 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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