Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The glamour style is built into the binary (`style.go`) and tuned for a narrow p

- Compact, with at most one blank line between blocks, no margins, and no trailing-space padding.
- Hex (truecolor) colors throughout, never 256-palette indexes, which Ghostty remaps.
- Teal, underlined links. Bare URLs stay on their own line, so Ghostty can detect them and make them clickable.
- Teal, underlined links. Bare URLs (on their own line, per convention) render as real OSC 8 hyperlinks — clickable in any terminal that supports them, Ghostty included — with the visible text shortened to fit the pane when the URL itself is longer, though the link always opens the full, untruncated address. In a terminal without OSC 8 support, the shortened text is just plain text.
- An H1 badge in black on lavender, H2 headings in muted amber with a `▍ ` prefix, and bold text in the default foreground.

To adjust the colors, edit the `color…` constants at the top of `style.go` — links use `colorLink` — and rebuild.
Expand Down
2 changes: 1 addition & 1 deletion diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestChangedLinesDeletionNoSpuriousMark(t *testing.T) {
func TestComposeMarkedNeverWiderThanWidth(t *testing.T) {
for _, w := range []int{20, 40, 80} {
lines, _ := func() ([]string, error) {
out, err := renderMarkdown("# Title\n\n- a fairly long bullet item that will wrap\n- short\n\nsome prose here too\n", w)
out, err := renderMarkdown("# Title\n\n- a fairly long bullet item that will wrap\n- short\n\nsome prose here too\n", w, true)
return strings.Split(out, "\n"), err
}()
all := map[int]bool{}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/charmbracelet/bubbletea v1.3.10
github.com/charmbracelet/glamour v1.0.0
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834
github.com/charmbracelet/x/ansi v0.11.6
github.com/fsnotify/fsnotify v1.10.1
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.16.0
golang.org/x/term v0.43.0
)
Expand All @@ -19,7 +19,6 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/charmbracelet/colorprofile v0.4.1 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect
Expand All @@ -36,6 +35,7 @@ require (
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.7.13 // indirect
Expand Down
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ func main() {

// runStatic renders the file once to stdout and exits — no watching, no
// alt-screen. Handy for piping, CI, and quick inline checks. Width is the
// terminal width (minus 2) when stdout is a TTY, else 80.
// terminal width (minus 2) when stdout is a TTY, else 80. Bare-URL OSC 8
// hyperlinking (and the display-text elision that comes with it) is skipped
// whenever stdout isn't a TTY: whatever's on the other end of the pipe —
// grep, an editor, a CI log — can't render the escape sequence anyway. A
// URL short enough to fit the fallback width comes through plain and
// intact; one long enough to still need wrapping hits glamour's original
// hard break instead (see renderMarkdown's linkify doc comment) — out of
// scope for this fix, just not silently hidden behind an OSC 8 escape.
func runStatic(args []string) int {
path := defaultBoardPath()
if len(args) > 0 {
Expand All @@ -113,11 +120,12 @@ func runStatic(args []string) int {
fmt.Fprintln(os.Stderr, "sidecar:", err)
return 1
}
isTTY := term.IsTerminal(int(os.Stdout.Fd()))
width := 80
if w, _, err := term.GetSize(int(os.Stdout.Fd())); err == nil && w > 0 {
width = w
}
out, err := renderMarkdown(string(data), width-2)
out, err := renderMarkdown(string(data), width-2, isTTY)
if err != nil {
fmt.Fprintln(os.Stderr, "sidecar:", err)
return 1
Expand Down
Loading