When you write documentation for your project or site, say a README Table of Content, you may need something like Tree to help you write a directory structure. Tree will display a list of directories as trees (with optional color/HTML output).
If you are a Mac user, you can use
Tree in the command line.
If you don’t already have Homebrew on your machine, install it first.
Then in the command line, simply run
then you can open a new window
It will output a nice directory tree within the terminal window that you can just paste into your documentation.
If you are using Markdown, just surround this code with triple backticks1 to get the same output.
Although using Tree in the command-line interface seems easier for me here are some other methods to the same end:
☞ Directory tree plugin adds directory tree to markdown files via markdown-magic. → Directory tree plugin GitHub repo. What’s nice is that it lets you control your directory structure depth and which folder or file you choose to ignore.
☞ If you prefer to generate your directory manually, you can use Shawn Chin’s interactive tree builder.
see the markdown docs: https://daringfireball.net/projects/markdown/syntax#code ↩
Leave a Comment
Your email address will not be published. Required fields are marked *