Skip to content

Commit

Permalink
Update README.md (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani authored Nov 28, 2023
1 parent bee9edf commit 254f1cf
Showing 1 changed file with 15 additions and 29 deletions.
44 changes: 15 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ Print the table.
fmt.Println(t)
```

![Table Example](https://github.com/charmbracelet/lipgloss/assets/42545625/6e4b70c4-f494-45da-a467-bdd27df30d5d)
<p align="center">
<img src="https://github.com/charmbracelet/lipgloss/assets/42545625/6e4b70c4-f494-45da-a467-bdd27df30d5d" width="800" />
</p>

For more on tables see [the docs](https://pkg.go.dev/github.com/charmbracelet/lipgloss?tab=doc) and [examples](https://github.com/charmbracelet/lipgloss/tree/master/examples/table).

Expand Down Expand Up @@ -513,15 +515,9 @@ Print the list.
fmt.Println(l)
```

```
• A
• Apricot
• B
• Bergamot orange
• C
• Citron
• Clymenia
```
<p align="center">
<img width="600" alt="image" src="https://github.com/charmbracelet/lipgloss/assets/42545625/0dc9f440-0748-4151-a3b0-7dcf29dfcdb0">
</p>

### Customization

Expand All @@ -546,23 +542,19 @@ l := list.New(

Print the list.

```
I. Glossier
II. Claire’s Boutique
III. Nyx
IV. Mac
V. Milk
```
<p align="center">
<img width="600" alt="List example" src="https://github.com/charmbracelet/lipgloss/assets/42545625/360494f1-57fb-4e13-bc19-0006efe01561">
</p>

In addition to the predefined enumerators (`Arabic`, `Alphabet`, `Roman`, `Bullet`, `Tree`),
you may also define your own custom enumerator:

```go
var DuckDuckGooseEnumerator Enumerator = func(l *List, i int) string {
if l.At(i) == "Goose" {
return ""
return "Honk →"
}
return " "
return ""
}
```

Expand All @@ -575,20 +567,14 @@ l.Enumerator(DuckDuckGooseEnumerator)

Print the list:

```
Duck
Duck
Duck
Duck
Duck
→ Goose
Duck
```
<p align="center">
<img width="600" alt="image" src="https://github.com/charmbracelet/lipgloss/assets/42545625/157aaf30-140d-4948-9bb4-dfba46e5b87e">
</p>


### Building

You can also build lists incrementally (with `.Item()`):
If you need, you can also build lists incrementally:

```go
l := list.New()
Expand Down

0 comments on commit 254f1cf

Please sign in to comment.