2025-06-19 14:33:03 -04:00
2025-06-19 14:18:55 -04:00
2025-06-19 14:18:55 -04:00
2025-06-19 14:18:55 -04:00
2019-12-19 00:43:46 +01:00
2020-08-24 15:46:02 +02:00
2025-06-19 14:18:55 -04:00
2019-12-20 22:55:00 +01:00
2019-12-20 22:55:00 +01:00
2024-03-13 21:07:19 -07:00
2025-06-19 14:33:03 -04:00
2025-06-19 14:33:03 -04:00
2023-05-11 12:38:35 +00:00
2023-03-22 14:50:30 -04:00
2025-06-19 14:18:55 -04:00

Glamour

Glamour Title Treatment
Latest Release GoDoc Build Status Coverage Status Go ReportCard

Stylesheet-based markdown rendering for your CLI apps.

Glamour dark style example

glamour lets you render markdown documents & templates on ANSI compatible terminals. You can create your own stylesheet or simply use one of the stylish defaults.

Usage

import "github.com/charmbracelet/glamour"

in := `# Hello World

This is a simple example of Markdown rendering with Glamour!
Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too.

Bye!
`

out, err := glamour.Render(in, "dark")
fmt.Print(out)
Hello World example

Custom Renderer

import "github.com/charmbracelet/glamour"

r, _ := glamour.NewTermRenderer(
    // detect background color and pick either the default dark or light theme
    glamour.WithAutoStyle(),
    // wrap output at specific width (default is 80)
    glamour.WithWordWrap(40),
)

out, err := r.Render(in)
fmt.Print(out)

Styles

You can find all available default styles in our gallery. Want to create your own style? Learn how!

There are a few options for using a custom style:

  1. Call glamour.Render(inputText, "desiredStyle")
  2. Set the GLAMOUR_STYLE environment variable to your desired default style or a file location for a style and call glamour.RenderWithEnvironmentConfig(inputText)
  3. Set the GLAMOUR_STYLE environment variable and pass glamour.WithEnvironmentConfig() to your custom renderer

Glamourous Projects

Check out these projects, which use glamour:

  • Glow, a markdown renderer for the command-line.
  • GitHub CLI, GitHubs official command line tool.
  • GitLab CLI, GitLab's official command line tool.
  • Gitea CLI, Gitea's official command line tool.
  • Meteor, an easy-to-use, plugin-driven metadata collection framework.

Feedback

Wed love to hear your thoughts on this project. Feel free to drop us a note!

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source

S
Description
A temporary, hacked together fork of Glamour v0.7.0 to reduce the startup time and binary size of MUTN while other solutions are evaluated.
Readme MIT
2.6 MiB
Languages
Go 98.5%
Shell 1.5%