2019-12-20 22:47:47 +01:00
|
|
|
|
# Glow
|
2019-11-09 16:12:54 -06:00
|
|
|
|
|
|
|
|
|
Render markdown on the CLI, with _pizzazz_!
|
|
|
|
|
|
2020-03-04 22:36:08 -05:00
|
|
|
|
<p align="center">
|
2020-12-24 17:06:48 -05:00
|
|
|
|
<img src="https://stuff.charm.sh/glow/glow-banner-github.gif" alt="Glow Logo">
|
2020-03-04 22:36:08 -05:00
|
|
|
|
<a href="https://github.com/charmbracelet/glow/releases"><img src="https://img.shields.io/github/release/charmbracelet/glow.svg" alt="Latest Release"></a>
|
|
|
|
|
<a href="https://pkg.go.dev/github.com/charmbracelet/glow?tab=doc"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
|
|
|
|
|
<a href="https://github.com/charmbracelet/glow/actions"><img src="https://github.com/charmbracelet/glow/workflows/build/badge.svg" alt="Build Status"></a>
|
2021-05-18 20:54:34 +02:00
|
|
|
|
<a href="https://goreportcard.com/report/github.com/charmbracelet/glow"><img src="https://goreportcard.com/badge/charmbracelet/glow" alt="Go ReportCard"></a>
|
2020-03-04 22:36:08 -05:00
|
|
|
|
</p>
|
|
|
|
|
|
2020-07-29 13:21:56 -04:00
|
|
|
|
<p align="center">
|
2024-08-23 14:49:31 -04:00
|
|
|
|
<img src="https://github.com/user-attachments/assets/c2246366-f84b-4847-b431-32a61ca07b74" width="800" alt="Glow UI Demo">
|
2020-07-29 13:21:56 -04:00
|
|
|
|
</p>
|
2019-12-18 21:49:29 -05:00
|
|
|
|
|
2020-07-29 11:49:36 -05:00
|
|
|
|
## What is it?
|
|
|
|
|
|
|
|
|
|
Glow is a terminal based markdown reader designed from the ground up to bring
|
2020-07-29 13:21:56 -04:00
|
|
|
|
out the beauty—and power—of the CLI.
|
2020-07-29 11:49:36 -05:00
|
|
|
|
|
2020-08-27 13:32:05 -04:00
|
|
|
|
Use it to discover markdown files, read documentation directly on the command
|
2024-07-03 12:11:29 -03:00
|
|
|
|
line. Glow will find local markdown files in subdirectories or a local
|
2020-08-27 13:36:08 -04:00
|
|
|
|
Git repository.
|
2020-08-27 13:32:05 -04:00
|
|
|
|
|
2019-12-16 06:04:55 -05:00
|
|
|
|
## Installation
|
|
|
|
|
|
2022-09-24 17:47:35 -07:00
|
|
|
|
### Package Manager
|
2019-12-18 21:36:30 -05:00
|
|
|
|
|
|
|
|
|
```bash
|
2020-01-12 14:24:07 -05:00
|
|
|
|
# macOS or Linux
|
2020-01-12 16:54:36 +01:00
|
|
|
|
brew install glow
|
|
|
|
|
|
2020-10-17 16:15:03 -04:00
|
|
|
|
# macOS (with MacPorts)
|
|
|
|
|
sudo port install glow
|
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
# Arch Linux (btw)
|
2022-01-24 01:53:57 +01:00
|
|
|
|
pacman -S glow
|
2019-12-23 20:44:56 +01:00
|
|
|
|
|
2020-02-26 11:47:09 -05:00
|
|
|
|
# Void Linux
|
|
|
|
|
xbps-install -S glow
|
|
|
|
|
|
2024-07-08 16:19:02 +02:00
|
|
|
|
# Nix shell
|
|
|
|
|
nix-shell -p glow --command glow
|
2020-01-13 12:44:52 -05:00
|
|
|
|
|
2019-12-23 20:44:56 +01:00
|
|
|
|
# FreeBSD
|
|
|
|
|
pkg install glow
|
2020-10-20 08:42:39 +08:00
|
|
|
|
|
2020-12-09 17:49:25 +01:00
|
|
|
|
# Solus
|
|
|
|
|
eopkg install glow
|
|
|
|
|
|
2023-12-07 17:49:20 +05:30
|
|
|
|
# Windows (with Chocolatey, Scoop, or Winget)
|
2022-09-10 04:26:52 +02:00
|
|
|
|
choco install glow
|
2023-12-07 17:49:20 +05:30
|
|
|
|
scoop install glow
|
|
|
|
|
winget install charmbracelet.glow
|
2021-02-16 15:03:01 +08:00
|
|
|
|
|
|
|
|
|
# Android (with termux)
|
|
|
|
|
pkg install glow
|
2022-07-08 12:06:55 -04:00
|
|
|
|
|
|
|
|
|
# Debian/Ubuntu
|
2022-10-17 16:48:40 -04:00
|
|
|
|
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
|
2022-07-08 12:06:55 -04:00
|
|
|
|
sudo apt update && sudo apt install glow
|
|
|
|
|
|
2022-10-17 16:48:40 -04:00
|
|
|
|
# Fedora/RHEL
|
2022-07-08 12:06:55 -04:00
|
|
|
|
echo '[charm]
|
|
|
|
|
name=Charm
|
|
|
|
|
baseurl=https://repo.charm.sh/yum/
|
|
|
|
|
enabled=1
|
2022-10-06 17:20:42 -04:00
|
|
|
|
gpgcheck=1
|
|
|
|
|
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
|
2022-07-08 12:06:55 -04:00
|
|
|
|
sudo yum install glow
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```
|
|
|
|
|
|
2020-10-13 22:56:33 -04:00
|
|
|
|
Or download a binary from the [releases][releases] page. MacOS, Linux, Windows,
|
2022-10-25 11:07:35 -03:00
|
|
|
|
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.
|
2019-12-21 20:37:01 -05:00
|
|
|
|
|
2022-09-24 17:47:35 -07:00
|
|
|
|
### Go
|
|
|
|
|
|
|
|
|
|
Or just install it with `go`:
|
2024-07-03 12:11:29 -03:00
|
|
|
|
|
2022-09-24 17:47:35 -07:00
|
|
|
|
```bash
|
|
|
|
|
go install github.com/charmbracelet/glow@latest
|
|
|
|
|
```
|
|
|
|
|
|
2024-07-09 16:38:10 -03:00
|
|
|
|
### Build (requires Go 1.21+)
|
2019-12-18 21:36:30 -05:00
|
|
|
|
|
|
|
|
|
```bash
|
2020-10-17 14:30:03 +02:00
|
|
|
|
git clone https://github.com/charmbracelet/glow.git
|
|
|
|
|
cd glow
|
|
|
|
|
go build
|
2019-12-16 18:52:10 +01:00
|
|
|
|
```
|
2019-12-16 06:04:55 -05:00
|
|
|
|
|
2019-12-21 20:37:01 -05:00
|
|
|
|
[releases]: https://github.com/charmbracelet/glow/releases
|
|
|
|
|
|
2020-08-27 14:21:45 -04:00
|
|
|
|
## The TUI
|
2019-11-09 16:12:54 -06:00
|
|
|
|
|
2020-10-18 19:11:45 +03:00
|
|
|
|
Simply run `glow` without arguments to start the textual user interface and
|
2024-07-03 12:11:29 -03:00
|
|
|
|
browse local. Glow will find local markdown files in the
|
2020-10-12 08:02:32 -04:00
|
|
|
|
current directory and below or, if you’re in a Git repository, Glow will search
|
2020-08-27 14:21:45 -04:00
|
|
|
|
the repo.
|
|
|
|
|
|
|
|
|
|
Markdown files can be read with Glow's high-performance pager. Most of the
|
2020-10-20 20:01:05 +08:00
|
|
|
|
keystrokes you know from `less` are the same, but you can press `?` to list
|
2020-08-27 14:21:45 -04:00
|
|
|
|
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:
|
2019-11-09 16:12:54 -06:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```bash
|
2019-12-13 20:44:32 +01:00
|
|
|
|
# Read from file
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow README.md
|
2019-12-13 20:36:25 +01:00
|
|
|
|
|
2019-12-13 20:44:32 +01:00
|
|
|
|
# Read from stdin
|
2020-12-08 21:47:00 +00:00
|
|
|
|
echo "[Glow](https://github.com/charmbracelet/glow)" | glow -
|
2019-11-22 04:51:44 +01:00
|
|
|
|
|
2019-12-28 04:47:15 +01:00
|
|
|
|
# Fetch README from GitHub / GitLab
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow github.com/charmbracelet/glow
|
2019-11-25 05:03:26 +01:00
|
|
|
|
|
2019-12-13 20:45:25 +01:00
|
|
|
|
# Fetch markdown from HTTP
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow https://host.tld/file.md
|
2019-11-22 04:51:44 +01:00
|
|
|
|
```
|
|
|
|
|
|
2019-12-13 03:29:52 +01:00
|
|
|
|
### Word Wrapping
|
2019-12-13 03:25:02 +01:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
The `-w` flag lets you set a maximum width at which the output will be wrapped:
|
2019-12-13 20:36:25 +01:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```bash
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow -w 60
|
2019-12-13 03:25:02 +01:00
|
|
|
|
```
|
|
|
|
|
|
2019-12-31 11:22:52 +01:00
|
|
|
|
### Paging
|
|
|
|
|
|
2020-08-27 13:50:46 -04:00
|
|
|
|
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.
|
2019-12-31 11:22:52 +01:00
|
|
|
|
|
2019-12-13 03:29:52 +01:00
|
|
|
|
### Styles
|
2019-12-13 03:25:02 +01:00
|
|
|
|
|
2020-01-14 02:20:21 +01:00
|
|
|
|
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.
|
2019-12-13 20:36:25 +01:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```bash
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow -s [dark|light]
|
2019-12-13 03:25:02 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Alternatively you can also supply a custom JSON stylesheet:
|
2019-12-13 20:36:25 +01:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```bash
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow -s mystyle.json
|
2019-11-26 21:03:46 +01:00
|
|
|
|
```
|
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
For additional usage details see:
|
|
|
|
|
|
|
|
|
|
```bash
|
2019-12-20 22:47:47 +01:00
|
|
|
|
glow --help
|
2019-12-18 21:36:30 -05:00
|
|
|
|
```
|
|
|
|
|
|
2020-08-27 13:32:05 -04:00
|
|
|
|
Check out the [Glamour Style Section](https://github.com/charmbracelet/glamour/blob/master/styles/gallery/README.md)
|
|
|
|
|
to find more styles. Or [make your own](https://github.com/charmbracelet/glamour/tree/master/styles)!
|
|
|
|
|
|
2020-10-23 08:34:32 +02:00
|
|
|
|
## The Config File
|
|
|
|
|
|
|
|
|
|
If you find yourself supplying the same flags to `glow` all the time, it's
|
2020-10-27 15:02:53 +01:00
|
|
|
|
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`.
|
2020-10-23 08:34:32 +02:00
|
|
|
|
|
|
|
|
|
Here's an example config:
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
# style name or JSON path (default "auto")
|
|
|
|
|
style: "light"
|
2024-08-23 13:23:40 -04:00
|
|
|
|
# mouse wheel support (TUI-mode only)
|
2021-02-04 01:38:52 +01:00
|
|
|
|
mouse: true
|
|
|
|
|
# use pager to display markdown
|
|
|
|
|
pager: true
|
2024-08-23 13:23:40 -04:00
|
|
|
|
# at which column should we word wrap?
|
2020-10-23 08:46:59 +02:00
|
|
|
|
width: 80
|
2024-10-01 19:23:20 +02:00
|
|
|
|
# show all files, including hidden and ignored.
|
2025-02-03 15:24:10 -03:00
|
|
|
|
all: false
|
2020-10-23 08:34:32 +02:00
|
|
|
|
```
|
|
|
|
|
|
2022-10-25 20:26:53 +02:00
|
|
|
|
## Feedback
|
|
|
|
|
|
|
|
|
|
We’d love to hear your thoughts on this project. Feel free to drop us a note!
|
|
|
|
|
|
2024-07-03 12:11:29 -03:00
|
|
|
|
- [Twitter](https://twitter.com/charmcli)
|
|
|
|
|
- [The Fediverse](https://mastodon.social/@charmcli)
|
|
|
|
|
- [Discord](https://charm.sh/chat)
|
2022-10-25 20:26:53 +02:00
|
|
|
|
|
2019-12-18 21:36:30 -05:00
|
|
|
|
## License
|
2019-11-09 16:12:54 -06:00
|
|
|
|
|
2019-12-20 22:47:47 +01:00
|
|
|
|
[MIT](https://github.com/charmbracelet/glow/raw/master/LICENSE)
|
2020-04-27 11:48:11 -04:00
|
|
|
|
|
2024-07-03 12:11:29 -03:00
|
|
|
|
---
|
2021-05-18 16:53:12 -04:00
|
|
|
|
|
2020-04-27 11:50:31 -04:00
|
|
|
|
Part of [Charm](https://charm.sh).
|
|
|
|
|
|
2022-10-25 20:26:53 +02:00
|
|
|
|
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>
|
2020-04-27 11:50:31 -04:00
|
|
|
|
|
2021-05-18 16:53:12 -04:00
|
|
|
|
Charm热爱开源 • Charm loves open source
|