Post

How to show folder structure in markdown ?

One can generate folder structure manually by command and copy the structure and enclose in three backticks symbols in Markdown.

1
2
3
4
5
#For Ubuntu/Debian
sudo apt install tree

# On MacOs
brew install tree
1
2
3
cd /path/to/folder/static

tree --dirsfirst --charset=ascii

This can be saved to yaml.

To make the folder structure more readable in markdown, one can specify the tree command with options like -I (ignore specific files) or limit the depth with -L. For example:

1
tree -L 2 > structure.md
This post is licensed under CC BY 4.0 by the author.