From 59cbf2850015999f321cfddddfca2133c12a665e Mon Sep 17 00:00:00 2001 From: bashbunni <15822994+bashbunni@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:58:04 -0800 Subject: [PATCH] chore(docs): links + minor grammar fixes (#409) Co-authored-by: Ayman Bagabas --- color.go | 7 ++++--- query.go | 4 ++-- set.go | 2 +- size.go | 7 +++---- style.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/color.go b/color.go index 60973325..040e0b8f 100644 --- a/color.go +++ b/color.go @@ -135,13 +135,14 @@ type LightDarkFunc func(light, dark color.Color) color.Color // In practice, there are slightly different workflows between Bubble Tea and // Lip Gloss standalone. // -// In Bubble Tea listen for tea.BackgroundColorMsg, which automatically -// flows through Update on start, and whenever the background color changes: +// In Bubble Tea, listen for tea.BackgroundColorMsg, which automatically +// flows through Update on start. This message will be received whenever the +// background color changes: // // case tea.BackgroundColorMsg: // m.hasDarkBackground = msg.IsDark() // -// Later, when you're rendering: +// Later, when you're rendering use: // // lightDark := lipgloss.LightDark(m.hasDarkBackground) // red, blue := lipgloss.Color("#ff0000"), lipgloss.Color("#0000ff") diff --git a/query.go b/query.go index 1faa2574..5fff4d05 100644 --- a/query.go +++ b/query.go @@ -73,8 +73,8 @@ func BackgroundColor(in *os.File, out *os.File) (bg color.Color, err error) { // lightDark := LightDark(hasDarkBG) // myHotColor := lightDark("#ff0000", "#0000ff") // -// This is intedded for use in standalone Lip Gloss only. In Bubble Tea, listen -// for tea.BackgroundColorMsg in your update function. +// This is intended for use in standalone Lip Gloss only. In Bubble Tea, listen +// for tea.BackgroundColorMsg in your Update function. // // case tea.BackgroundColorMsg: // hasDarkBackground = msg.IsDark() diff --git a/set.go b/set.go index 60937513..3172e68b 100644 --- a/set.go +++ b/set.go @@ -175,7 +175,7 @@ func (s Style) Italic(v bool) Style { // Underline sets an underline rule. By default, underlines will not be drawn on // whitespace like margins and padding. To change this behavior set -// UnderlineSpaces. +// [Style.UnderlineSpaces]. func (s Style) Underline(v bool) Style { s.set(underlineKey, v) return s diff --git a/size.go b/size.go index e169ff5e..5853f416 100644 --- a/size.go +++ b/size.go @@ -10,7 +10,7 @@ import ( // ignored and characters wider than one cell (such as Chinese characters and // emojis) are appropriately measured. // -// You should use this instead of len(string) len([]rune(string) as neither +// You should use this instead of len(string) or len([]rune(string) as neither // will give you accurate results. func Width(str string) (width int) { for _, l := range strings.Split(str, "\n") { @@ -24,9 +24,8 @@ func Width(str string) (width int) { } // Height returns height of a string in cells. This is done simply by -// counting \n characters. If your strings use \r\n for newlines you should -// convert them to \n first, or simply write a separate function for measuring -// height. +// counting \n characters. If your output has \r\n, that sequence will be +// replaced with a \n in [Style.Render]. func Height(str string) int { return strings.Count(str, "\n") + 1 } diff --git a/style.go b/style.go index b4d4627e..0f342cd8 100644 --- a/style.go +++ b/style.go @@ -96,7 +96,7 @@ func (p props) has(k propKey) bool { } // NewStyle returns a new, empty Style. While it's syntactic sugar for the -// Style{} primitive, it's recommended to use this function for creating styles +// [Style]{} primitive, it's recommended to use this function for creating styles // in case the underlying implementation changes. func NewStyle() Style { return Style{} @@ -155,10 +155,10 @@ func joinString(strs ...string) string { } // SetString sets the underlying string value for this style. To render once -// the underlying string is set, use the Style.String. This method is +// the underlying string is set, use the [Style.String]. This method is // a convenience for cases when having a stringer implementation is handy, such // as when using fmt.Sprintf. You can also simply define a style and render out -// strings directly with Style.Render. +// strings directly with [Style.Render]. func (s Style) SetString(strs ...string) Style { s.value = joinString(strs...) return s