File: tree.md

package info (click to toggle)
markdown-exec 1.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 740 kB
  • sloc: python: 2,497; javascript: 180; makefile: 32; sh: 30
file content (74 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Tree

Markdown Exec provides a `tree` formatter that can be used
to render file-system trees easily:

````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
```tree
root1
    file1
    dir1
        file
    dir2
        file1
        file2
    file2
    file3
root2
    file1
```
````

By default, the language used for syntax highlight is `bash`.
It means you can add comments with `#`:

````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
```tree
root1            # comment 1
    file1
    dir1
        file
    dir2
        file1    # comment 2
        file2    # comment 3
    file2
    file3
root2
    file1
```
````

You can change the syntax highlight language with the `result` option:

````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
```tree result="javascript"
root1            // comment 1
    file1
    dir1
        file
    dir2
        file1    // comment 2
        file2    // comment 3
    file2
    file3
root2
    file1
```
````

You can force an entry to be displayed as a directory instead of a regular file
by appending a trailing slash to the name:

````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
```tree
root1
    dir1/
    dir2/
    dir3/
```
````

It is recommended to always append trailing slashes to directory anyway.

WARNING: **Limitation:**
Spaces in file names are not supported when searching for a trailing slash.