Top Related Projects
GitHub’s official command line tool
simple terminal UI for git commands
:cherry_blossom: A command-line fuzzy finder
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
A cat(1) clone with wings.
A modern replacement for ‘ls’.
Quick Overview
Glow is a terminal-based markdown reader, renderer, and previewer. It allows users to view and interact with markdown files directly in the command line, offering syntax highlighting, paging, and even the ability to style the output.
Pros
- Seamless integration with terminal workflows
- Supports custom themes and styles
- Can render markdown from various sources (files, stdin, URLs)
- Offers both a TUI (Terminal User Interface) and a CLI mode
Cons
- Limited to terminal environments, not suitable for GUI preferences
- May require some learning curve for users unfamiliar with terminal-based tools
- Rendering complex markdown elements (like tables) can be challenging in some terminal emulators
- Lacks some advanced features found in GUI-based markdown viewers
Getting Started
To install Glow, you can use one of the following methods:
# macOS or Linux with Homebrew
brew install glow
# macOS with MacPorts
sudo port install glow
# Windows with Scoop
scoop install glow
# Using Go
go install github.com/charmbracelet/glow@latest
Basic usage:
# View a markdown file
glow README.md
# View a markdown file from a URL
glow https://raw.githubusercontent.com/charmbracelet/glow/master/README.md
# Enter TUI mode
glow
For more advanced usage and configuration options, refer to the official documentation.
Competitor Comparisons
GitHub’s official command line tool
Pros of cli
- Comprehensive GitHub CLI tool with a wide range of features
- Official GitHub product with strong support and regular updates
- Extensive documentation and community resources
Cons of cli
- Larger and more complex, potentially overwhelming for simple tasks
- Focused solely on GitHub, not suitable for general Markdown viewing
Code comparison
glow:
glow README.md
cli:
gh repo view
gh issue list
gh pr create
Summary
glow is a focused Markdown renderer for the terminal, while cli is a full-featured GitHub command-line interface. glow excels at displaying Markdown files with syntax highlighting and formatting, making it ideal for viewing documentation and README files locally. cli, on the other hand, provides a comprehensive set of tools for interacting with GitHub repositories, issues, pull requests, and more.
glow is lightweight and can be used with any Markdown file, regardless of its source. cli is specifically designed for GitHub users and offers deeper integration with the platform's features. While glow is perfect for quick Markdown viewing, cli is better suited for developers who frequently work with GitHub and need a powerful command-line tool to manage their repositories and collaborate with others.
simple terminal UI for git commands
Pros of Lazygit
- Interactive TUI for Git operations, offering a more user-friendly experience
- Comprehensive Git functionality, including branch management, staging, and commit history
- Customizable keybindings and color schemes for personalized workflow
Cons of Lazygit
- Steeper learning curve due to its extensive feature set
- Requires terminal with specific capabilities, potentially limiting compatibility
- May be overwhelming for users who prefer simpler Git interfaces
Code Comparison
Lazygit (Go):
func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
message := gui.trimmedContent(v)
if message == "" {
return gui.createErrorPanel(gui.Tr.NoCommitMessageErr)
}
return gui.handleCommitSubmit(message)
}
Glow (Go):
func (m Model) View() string {
var s strings.Builder
s.WriteString(m.viewport.View())
s.WriteString("\n\n")
s.WriteString(helpStyle.Render(m.help.View(m.keys)))
return s.String()
}
While both projects are written in Go, Lazygit focuses on Git operations, whereas Glow is designed for rendering Markdown. Lazygit's code snippet demonstrates handling Git commits, while Glow's code shows rendering of Markdown content in the terminal.
:cherry_blossom: A command-line fuzzy finder
Pros of fzf
- More versatile, can be used for general-purpose fuzzy finding beyond just file searching
- Highly customizable with extensive options and keybindings
- Integrates well with various command-line tools and text editors
Cons of fzf
- Primarily focused on command-line usage, less suitable for rendering formatted content
- Steeper learning curve due to its extensive features and configuration options
- Not specifically designed for Markdown rendering or documentation viewing
Code Comparison
fzf (command-line usage):
find * -type f | fzf > selected
glow (rendering Markdown):
glow README.md
Summary
fzf is a powerful and flexible fuzzy finder for the command line, excelling in file and text searching across various contexts. It offers extensive customization but requires more setup and learning.
glow, on the other hand, is specifically designed for rendering and browsing Markdown files with a focus on beautiful terminal output. It's more user-friendly for quick documentation viewing but less versatile for general-purpose searching.
Choose fzf for advanced fuzzy finding capabilities across your system, or glow for a streamlined Markdown viewing experience in the terminal.
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
Pros of ripgrep
- Extremely fast and efficient for searching large codebases
- Supports advanced regex patterns and search options
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of ripgrep
- Limited to text-based searching and doesn't render Markdown
- Lacks visual enhancements for displaying search results
Code comparison
ripgrep:
rg "pattern" --type=md
glow:
glow search "pattern"
Summary
ripgrep is a powerful command-line search tool optimized for speed and efficiency in large codebases. It excels at text-based searches with advanced regex support. However, it lacks the Markdown rendering and visual enhancements offered by glow.
glow, on the other hand, is specifically designed for rendering and browsing Markdown files with a focus on aesthetics and readability. While it may not match ripgrep's raw search speed, it provides a more visually appealing experience for Markdown-centric workflows.
Choose ripgrep for fast, comprehensive text searches across various file types, and opt for glow when working primarily with Markdown files and prioritizing visual presentation.
A cat(1) clone with wings.
Pros of bat
- Syntax highlighting for a wide range of programming languages and file formats
- Git integration, showing file modifications in the output
- Automatic paging for long files, similar to
less
Cons of bat
- Primarily focused on file viewing, lacks specific Markdown rendering features
- May have a steeper learning curve for users unfamiliar with command-line tools
Code comparison
bat:
bat file.md
glow:
glow file.md
Key differences
- bat is a general-purpose file viewer with syntax highlighting, while glow specializes in rendering Markdown files
- glow offers a more visually appealing Markdown output, including support for terminal styling and themes
- bat provides additional features like line numbering and git integration, which are not primary focuses of glow
Use cases
bat:
- Viewing and inspecting various file types with syntax highlighting
- Comparing file changes in git repositories
- Replacing
cat
andless
commands with enhanced functionality
glow:
- Rendering and reading Markdown files directly in the terminal
- Creating visually appealing documentation previews
- Enhancing Markdown-based workflows and note-taking systems
Both tools serve different purposes and can be complementary in a developer's toolkit, with bat excelling at general file viewing and glow specializing in Markdown rendering.
A modern replacement for ‘ls’.
Pros of exa
- Focused on file listing and directory exploration, providing a modern replacement for the
ls
command - Offers color-coded output and icons for improved visual representation of files and directories
- Includes additional file metadata and sorting options not available in traditional
ls
Cons of exa
- Limited to file listing functionality, unlike Glow's broader Markdown rendering capabilities
- Requires installation of additional dependencies for full feature support (e.g., icons)
- Development has slowed down, with fewer recent updates compared to Glow
Code comparison
exa:
exa -l --git
Glow:
glow README.md
Key differences
- Purpose: exa is a file listing tool, while Glow is a Markdown renderer
- Functionality: exa focuses on directory exploration, Glow on document viewing
- Use case: exa is more suited for system administrators and power users, Glow for developers and writers working with Markdown
Conclusion
While both tools aim to enhance command-line experiences, they serve different purposes. exa modernizes file listing, whereas Glow improves Markdown viewing. The choice between them depends on the specific needs of the user and their workflow.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Glow
Render markdown on the CLI, with pizzazz!
What is it?
Glow is a terminal based markdown reader designed from the ground up to bring out the beautyâand powerâof the CLI.
Use it to discover markdown files, read documentation directly on the command line. Glow will find local markdown files in subdirectories or a local Git repository.
Installation
Package Manager
# macOS or Linux
brew install glow
# macOS (with MacPorts)
sudo port install glow
# Arch Linux (btw)
pacman -S glow
# Void Linux
xbps-install -S glow
# Nix shell
nix-shell -p glow --command glow
# FreeBSD
pkg install glow
# Solus
eopkg install glow
# Windows (with Chocolatey, Scoop, or Winget)
choco install glow
scoop install glow
winget install charmbracelet.glow
# Android (with termux)
pkg install glow
# Ubuntu (Snapcraft)
sudo snap install glow
# Debian/Ubuntu
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
sudo apt update && sudo apt install glow
# Fedora/RHEL
echo '[charm]
name=Charm
baseurl=https://repo.charm.sh/yum/
enabled=1
gpgcheck=1
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
sudo yum install glow
Or download a binary from the releases page. MacOS, Linux, Windows, FreeBSD and OpenBSD binaries are available, as well as Debian, RPM, and Alpine packages. ARM builds are also available for macOS, Linux, FreeBSD and OpenBSD.
Go
Or just install it with go
:
go install github.com/charmbracelet/glow@latest
Build (requires Go 1.21+)
git clone https://github.com/charmbracelet/glow.git
cd glow
go build
The TUI
Simply run glow
without arguments to start the textual user interface and
browse local. Glow will find local markdown files in the
current directory and below or, if youâre in a Git repository, Glow will search
the repo.
Markdown files can be read with Glow's high-performance pager. Most of the
keystrokes you know from less
are the same, but you can press ?
to list
the hotkeys.
The CLI
In addition to a TUI, Glow has a CLI for working with Markdown. To format a document use a markdown source as the primary argument:
# Read from file
glow README.md
# Read from stdin
echo "[Glow](https://github.com/charmbracelet/glow)" | glow -
# Fetch README from GitHub / GitLab
glow github.com/charmbracelet/glow
# Fetch markdown from HTTP
glow https://host.tld/file.md
Word Wrapping
The -w
flag lets you set a maximum width at which the output will be wrapped:
glow -w 60
Paging
CLI output can be displayed in your preferred pager with the -p
flag. This defaults
to the ANSI-aware less -r
if $PAGER
is not explicitly set.
Styles
You can choose a style with the -s
flag. When no flag is provided glow
tries
to detect your terminal's current background color and automatically picks
either the dark
or the light
style for you.
glow -s [dark|light]
Alternatively you can also supply a custom JSON stylesheet:
glow -s mystyle.json
For additional usage details see:
glow --help
Check out the Glamour Style Section to find more styles. Or make your own!
The Config File
If you find yourself supplying the same flags to glow
all the time, it's
probably a good idea to create a config file. Run glow config
, which will open
it in your favorite $EDITOR. Alternatively you can manually put a file named
glow.yml
in the default config path of you platform. If you're not sure where
that is, please refer to glow --help
.
Here's an example config:
# style name or JSON path (default "auto")
style: "light"
# mouse wheel support (TUI-mode only)
mouse: true
# use pager to display markdown
pager: true
# at which column should we word wrap?
width: 80
# show all files, including hidden and ignored.
all: false
# show line numbers (TUI-mode only)
showLineNumbers: false
# preserve newlines in the output
preserveNewLines: false
Contributing
See contributing.
Feedback
Weâd love to hear your thoughts on this project. Feel free to drop us a note!
License
Part of Charm.
Charmçç±å¼æº ⢠Charm loves open source
Top Related Projects
GitHub’s official command line tool
simple terminal UI for git commands
:cherry_blossom: A command-line fuzzy finder
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
A cat(1) clone with wings.
A modern replacement for ‘ls’.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot