What's New in Glamour v2
We're excited to announce the second major release of Glamour!
If you (or your LLM) are just looking for technical details on migrating from v1, please check out the Upgrade Guide.
Note
We don't take API changes lightly and strive to make the upgrade process as simple as possible. We believe these changes bring necessary improvements and pave the way for the future. If something feels way off, let us know.
❤️ Charm Land Import Path
We've updated our import paths to use vanity domains and use our domain to import Go packages.
// Before
import "github.com/charmbracelet/glamour"
// After
import "charm.land/glamour/v2"💄 Lip Gloss v2 Integration
Glamour v2 now uses Lip Gloss v2 under the hood, bringing improved performance and more consistent styling across the Charm ecosystem.
Since Glamour is designed to be pure (same input = same output), it doesn't peek at your terminal's capabilities. Instead, color downsampling is handled explicitly via Lip Gloss when you're ready to render:
r, _ := glamour.NewTermRenderer(glamour.WithWordWrap(80))
out, _ := r.Render(markdown)
// Downsample colors based on terminal capabilities
lipgloss.Print(out)No more I/O fights between Glamour and Lip Gloss. Glamour focuses on rendering, Lip Gloss handles the colors. Everyone's happy!
🌏 Better Text Wrapping
Text wrapping has been rewritten using lipgloss.Wrap, which means way better handling of:
- Multi-byte UTF-8 characters (CJK, emojis, etc.)
- Complex Unicode sequences
- Terminal cell width edge cases
Your Japanese documentation, emoji-filled READMEs, and creative Unicode art will all render beautifully now.
🔗 Hyperlink Support
Glamour now supports ANSI hyperlinks! If your terminal supports OSC 8 (and many modern terminals do), your links can be clickable. No changes needed, it just works.
md := `Check out [Charm](https://charm.sh) for more awesome tools!`
out, _ := glamour.Render(md, "dark")
fmt.Print(out)
// In supporting terminals, "Charm" will be clickable!Which terminals support OSC 8 hyperlinks?
📧 Cleaner Email Rendering
Email autolinks now hide the mailto: prefix for a cleaner look while remaining functional. Because nobody wants to read mailto: in their rendered markdown.
// Before (v1): Rendered as "mailto:hello@charm.sh"
md := `Contact us at <hello@charm.sh>`
out, _ := glamour.Render(md, "dark")
// Output: mailto:hello@charm.sh (ugly!)
// After (v2): Rendered as just "hello@charm.sh"
md := `Contact us at <hello@charm.sh>`
out, _ := glamour.Render(md, "dark")
// Output: hello@charm.sh (much better!)🌙 Dark is the New Default
The WithAutoStyle() option and AutoStyle have been removed. The default style is now "dark", which works well across most terminals. You can still explicitly choose any style:
// Use a specific style
out, _ := glamour.Render(markdown, "light")
out, _ := glamour.Render(markdown, "pink")
out, _ := glamour.Render(markdown, "dracula")
out, _ := glamour.Render(markdown, "tokyo-night")Simpler is better!
🎨 Color Profile Changes
The WithColorProfile() option has been removed. Color adaptation is now handled by Lip Gloss when rendering output:
// Old approach (v1)
r, _ := glamour.NewTermRenderer(
glamour.WithColorProfile(termenv.TrueColor),
)
// New approach (v2)
r, _ := glamour.NewTermRenderer(glamour.WithWordWrap(80))
out, _ := r.Render(markdown)
lipgloss.Print(out) // Handles color downsampling automaticallyThis separation of concerns makes Glamour's rendering more predictable and testable.
👋 Farewell, Overline
The Overlined field has been removed from all style primitives. It was rarely used and not widely supported across terminals. If you need similar visual separation, consider using underline, bold, or background colors instead.
🐛 Bug Fixes
- Fixed CJK character rendering in margin writers
- Fixed table background colors to match document styling
- Improved handling of edge cases in text wrapping
- Better handling of code spans with special characters
🌈 More on Glamour v2
Ready to migrate? Head over to the Upgrade Guide for the full migration checklist.
Changelog
New!
- c84017c: feat(ansi): add hyperlink support (@aymanbagabas)
Fixed
- 087c9c6: fix(ansi): handle multi-byte UTF-8 characters correctly in margin writers (@Gustave-241021)
- df61d8e: fix(ansi): remove unused overline style (@aymanbagabas)
- ffb4696: fix(gen): style generator: use absolute path for output files (@aymanbagabas)
- 510d0f0: fix(table): ensure document background color applies to table as well (#431) (@andreynering)
- c0a9b8d: fix(v2): import path /v2 (#412) (@caarlos0)
- 5a82082: fix: hide mailto: prefix in rendered email links (@Gustave-241021)
Docs
- 5f3f7be: docs: add v2 upgrade guide + release notes (#509) (@aymanbagabas)
- d1c81b3: docs: remove WithAutoStyle in README and examples (@meowgorithm)
- 86f90cf: docs: update README with v2 import paths and color downsampling example (@aymanbagabas)
Other stuff
- 4c9b764: perf(ansi): ensure all PenWriter instances are closed (#465) (@tazjin)
- f8f160e: refactor!: migrate to lipgloss v2 (@aymanbagabas)
- 9f9007e: refactor(ansi): drop reflow and use cellbuf.Wrap (@aymanbagabas)
- 69649f9: refactor: migrate to charm.land module path (#489) (@aymanbagabas)
- cd9a02a: refactor: remove auto style and make dark the default (@aymanbagabas)
- 800eb81: refactor: use lipgloss wrap, nbsp for codespan, new uv api, and update testdata (@aymanbagabas)
Feedback
Have thoughts on Glamour v2? We'd love to hear about it. Let us know on…
Part of Charm.
Charm热爱开源 • Charm loves open source