https://github.com/8lwxpg/typst-treet
Create tree list easily in Typst
https://github.com/8lwxpg/typst-treet
list tree typst typst-package
Last synced: 4 months ago
JSON representation
Create tree list easily in Typst
- Host: GitHub
- URL: https://github.com/8lwxpg/typst-treet
- Owner: 8LWXpg
- License: mit
- Created: 2024-01-06T16:34:20.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-04-29T13:25:16.000Z (about 1 year ago)
- Last Synced: 2025-04-29T14:40:11.814Z (about 1 year ago)
- Topics: list, tree, typst, typst-package
- Language: Typst
- Homepage:
- Size: 359 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Treet
Create tree list easily in Typst
contribution is welcomed!
## Usage
```typst
#import "@preview/treet:1.0.0": *
#tree-list(
marker: content,
last-marker: content,
indent: content,
empty-indent: content,
marker-font: string,
content,
)
```
### Parameters
- `marker` - the marker of the tree list, default is `[├─ ]`
- `last-marker` - the marker of the last item of the tree list, default is `[└─ ]`
- `indent` - the indent after `marker`, default is `[│#h(1em)]`
- `empty-indent` - the indent after `last-marker`, default is `[#h(1.5em)]` (same width as indent)
- `marker-font` - the font of the marker, default is `"Cascadia Code"`
- `content` - the content of the tree list, includes at least a list
## Demo
see [demo.typ](https://github.com/8LWXpg/typst-treet/blob/master/test/demo.typ) [demo.pdf](https://github.com/8LWXpg/typst-treet/blob/master/test/demo.pdf)
### Default style
```typst
#tree-list[
- 1
- 1.1
- 1.1.1
- 1.2
- 1.2.1
- 1.2.2
- 1.2.2.1
- 2
- 3
- 3.1
- 3.1.1
- 3.2
]
```

### Custom style
```typst
#text(red, tree-list(
marker: text(blue)[├── ],
last-marker: text(aqua)[└── ],
indent: text(teal)[│#h(1.5em)],
empty-indent: h(2em),
)[
- 1
- 1.1
- 1.1.1
- 1.2
- 1.2.1
- 1.2.2
- 1.2.2.1
- 2
- 3
- 3.1
- 3.1.1
- 3.2
])
```

### Using show rule
```typst
#show list: tree-list
#set text(font: "DejaVu Sans Mono")
root_folder\
- sub-folder
- 1-1
- 1.1.1 -
- 1.2
- 1.2.1
- 1.2.2
- 2
```
