I want to properly format the directory tree diagram, like:
- /folder1
- /folder2
- /folder3
- file1
- file2
What markup should I use for this purpose?
I want to properly format the directory tree diagram, like:
- /folder1
- /folder2
- /folder3
- file1
- file2
What markup should I use for this purpose?
I know I am digging up the subject, but I had the same question while writing documentation, and none of the proposed solutions suited me (like the author it seems). So for future reference, here another solution
Using only ascii characters to form the tree structure (│, ├, ─, └), and Shift + Enter between lines to reduce line spacing. It's quite visual
├─ folder1
│ ├─ subFolder1
│ ├─ subFolder2
│ ├─ subFolder3
│ └─ subFolder4
└─ folder2
If you have access to the Linux tree
command you can do tree -Q --charset=ascii
. (you can use cygwin under Windows) This is not the same as MTD's answer because you have to account for the output characters and quoting the filenames with spaces. If you don't use --charset=ascii
you will get characters that Confluence can't handle.
tree -Q --charset=ascii
.
`-- "Folder 1"
|-- "Folder 2"
`-- "Folder 3"
|-- "File 1"
`-- "File 2"
3 directories, 2 files
Then place it in a code block on Confluence
I've just used the Code Block macro and inserted plain text as in your question, or the output of tree -d .
Are you looking for something like below snapshot? If so, then this is how you can achieve this.
You can use toolbar icons to do the above formatting but it's easy for me to use keyboard hence provided you this approach.
You can learn more about text formatting in Confluence from Atlassian's documentation:
Thank you!
© 2022 - 2024 — McMap. All rights reserved.