Skip to main content

# Tree HTML

Tree HTML renders an interactive directory structure in html from a local path on disk. It can be run as a standalone python tool or it can be fed JSON output produced by running tree separately somewhere else. This tool was built on top of the [CodyHouse](https://github.com/CodyHouse/multi-level-accordion-menu) HTML/CSS codebase for displaying files and directories neatly.

See the example output from running tree-html on this repo:

![screenshot](tree-html-screenshot.png)

## General usage

In the most common case, tree-html can be run as a standalone tool on the current working directory as follows: ` tree-html `

A second use case involves supplying tree-html with the output json file obtained from running tree -J separately. This may be useful, for example, in cases where you are working on a different file system to the target path. This can be achieved by using the -i flag; for example: ` tree-html -i output-file-from-tree.json `

The default output from tree-html is a directory named tree-html/ which is generated in the current working directory. This directory contains a file called index.html, which can be opened in any browser for display. Note that this directory also contains some static assets that should always accompany the html file if the folder is to be moved or shared.

## Usage options

To execute the tool from a location other than the current working directory: ` tree-html /path/to/different/cool-location `

In the above case, it also might be desirable to specify a different top-level directory name to use in the output, rather than the full path. This can be achieved as follows: ` tree-html /path/to/different/cool-location -n cooler-location `

To limit the output to only contain a given depth below the top-level directory, the -l flag can be used: ` tree -l 3 # limits the output to three levels below the parent and ignores anything deeper `

Additional options may be supplied to customise the content and styling of the output file, such as using custom headings, text descriptions, different colored themes and url links. Run tree-html –help for the complete set of available options.

## Installation

Install using pip: ` pip install tree-html `

Or if you prefer to use pipenv to automatically install tree-html into a new isolated virtual environment: ` pipenv install . `

If you wish to develop this tool further then you should also install the development dependencies: ` pipenv install --dev `

If you would like to contribute, please either create a new branch or fork this repo and then submit a pull request. All contributions are welcome.

Metadata

Release files for tree-html 1.1.2

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

Built distribution (wheel)

Table of built distributions (wheels) for tree-html 1.1.2
File Interpreter ABI Platform
tree_html-1.1.2-py3-none-any.whl Python 3 none any Details

Release files / tree_html-1.1.2-py3-none-any.whl

Download URL tree_html-1.1.2-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3fc7d540b7ad19a5d9b8ed3e811ea5b770aafd1cb0eee39ac0ecb87c37c4adc
BLAKE2b-256 checksum
How to use checksums
864543b8339886cfaf26925b5acf3b63dc81eb8f5bc6781bea4b15e8dc1a08a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

1.1.2 This release

1 release file

1.1.0

1 release file

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