glow/README.md

113 lines
2.7 KiB
Markdown
Raw Normal View History

2019-12-20 21:47:47 +00:00
# Glow
2019-11-09 22:12:54 +00:00
2020-01-09 14:42:56 +00:00
[![Latest Release](https://img.shields.io/github/release/charmbracelet/glow.svg)](https://github.com/charmbracelet/glow/releases) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/charmbracelet/glow) [![Build Status](https://github.com/charmbracelet/glow/workflows/build/badge.svg)](https://github.com/charmbracelet/glow/actions) [![Go ReportCard](http://goreportcard.com/badge/charmbracelet/glow)](http://goreportcard.com/report/charmbracelet/glow)
2019-12-23 01:29:45 +00:00
2019-11-09 22:12:54 +00:00
Render markdown on the CLI, with _pizzazz_!
2020-01-06 18:19:43 +00:00
![Glow example output](https://github.com/charmbracelet/glow/raw/master/example.png)
2019-12-19 02:36:30 +00:00
2019-12-16 11:04:55 +00:00
## Installation
2019-12-19 02:36:30 +00:00
Use your fave package manager:
```bash
# macOS or Linux
2020-01-12 15:54:36 +00:00
brew install glow
2019-12-19 02:36:30 +00:00
# Arch Linux (btw)
2019-12-20 21:47:47 +00:00
yay -S glow
2019-12-23 19:44:56 +00:00
# Nix
nix-env -iA nixpkgs.glow
2019-12-23 19:44:56 +00:00
# FreeBSD
pkg install glow
2019-12-19 02:36:30 +00:00
```
2019-12-22 01:37:01 +00:00
Or download a binary from the [releases][] page. Windows, MacOS, and Linux
(including ARM) binaries are available, as well as Debian and RPM packages.
2019-12-19 02:36:30 +00:00
Or just use `go get`:
```bash
2019-12-20 21:47:47 +00:00
go get github.com/charmbracelet/glow
2019-12-16 17:52:10 +00:00
```
2019-12-16 11:04:55 +00:00
2019-12-22 01:37:01 +00:00
[releases]: https://github.com/charmbracelet/glow/releases
2019-12-19 02:36:30 +00:00
2019-11-09 22:12:54 +00:00
## Usage
2019-12-13 02:25:02 +00:00
Use a markdown source as the primary argument:
2019-11-09 22:12:54 +00:00
2019-12-19 02:36:30 +00:00
```bash
2019-12-13 19:44:32 +00:00
# Read from file
2019-12-20 21:47:47 +00:00
glow README.md
2019-12-13 19:36:25 +00:00
2019-12-13 19:44:32 +00:00
# Read from stdin
2019-12-20 21:47:47 +00:00
glow -
2019-11-22 03:51:44 +00:00
# Fetch README from GitHub / GitLab
2019-12-20 21:47:47 +00:00
glow github.com/charmbracelet/glow
2019-11-25 04:03:26 +00:00
2019-12-13 19:45:25 +00:00
# Fetch markdown from HTTP
2019-12-20 21:47:47 +00:00
glow https://host.tld/file.md
2019-11-22 03:51:44 +00:00
```
2019-12-20 21:47:47 +00:00
When `glow` is started without a markdown source, it will try to find a
2019-11-26 20:03:46 +00:00
`README.md` or `README` file in the current working directory.
### Word Wrapping
2019-12-13 02:25:02 +00:00
2019-12-19 02:36:30 +00:00
The `-w` flag lets you set a maximum width at which the output will be wrapped:
2019-12-13 19:36:25 +00:00
2019-12-19 02:36:30 +00:00
```bash
2019-12-20 21:47:47 +00:00
glow -w 60
2019-12-13 02:25:02 +00:00
```
2019-12-31 10:22:52 +00:00
### Paging
The output can be displayed in the user's preferred pager with the `-p` flag.
This defaults to the ANSI-aware `less -r` if `$PAGER` is not explicitly set.
### Styles
2019-12-13 02:25:02 +00:00
2020-01-14 01:20:21 +00: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 19:36:25 +00:00
2019-12-19 02:36:30 +00:00
```bash
2019-12-20 21:47:47 +00:00
glow -s [dark|light]
2019-12-13 02:25:02 +00:00
```
Alternatively you can also supply a custom JSON stylesheet:
2019-12-13 19:36:25 +00:00
2019-12-19 02:36:30 +00:00
```bash
2019-12-20 21:47:47 +00:00
glow -s mystyle.json
2019-11-26 20:03:46 +00:00
```
2019-12-19 02:36:30 +00: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)!
***
For additional usage details see:
```bash
2019-12-20 21:47:47 +00:00
glow --help
2019-12-19 02:36:30 +00:00
```
2019-12-19 02:36:30 +00:00
## Authors
* [Christian Muehlhaeuser](https://github.com/muesli)
* [Toby Padilla](https://github.com/toby)
* [Christian Rocha](https://github.com/meowgorithm)
Part of [Charm](https://charm.sh). For more info see `ssh charm.sh`. Charm热爱开源!
2019-11-24 04:19:13 +00:00
2019-12-19 02:36:30 +00:00
## License
2019-11-09 22:12:54 +00:00
2019-12-20 21:47:47 +00:00
[MIT](https://github.com/charmbracelet/glow/raw/master/LICENSE)