Glow is a terminal based markdown reader designed from the ground up to bring out the beauty—and power—of the CLI.💅🏻

Overview

Glow

Render markdown on the CLI, with pizzazz!

Glow Logo Latest Release GoDoc Build Status Go ReportCard

Glow UI Demo

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 and stash markdown files to your own private collection so you can read them anywhere. Glow will find local markdown files in subdirectories or a local Git repository.

By the way, all data stashed is encrypted end-to-end: only you can decrypt it. More on that below.

Installation

Use your fave package manager:

# macOS or Linux
brew install glow

# macOS (with MacPorts)
sudo port install glow

# Arch Linux (btw)
yay -S glow

# Void Linux
xbps-install -S glow

# Nix
nix-env -iA nixpkgs.glow

# FreeBSD
pkg install glow

# Solus
eopkg install glow

# Windows (with Scoop)
scoop install glow

# Android (with termux)
pkg 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.

Or just build it yourself (requires Go 1.13+):

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 and stashed markdown. 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.

Stashing

Glow works with the Charm Cloud to allow you to store any markdown files in your own private collection. You can stash a local document from the Glow TUI by pressing s.

Stashing is private, its contents will not be exposed publicly, and it's encrypted end-to-end. More on encryption below.

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
glow -

# Fetch README from GitHub / GitLab
glow github.com/charmbracelet/glow

# Fetch markdown from HTTP
glow https://host.tld/file.md

Stashing

You can also stash documents from the CLI:

glow stash README.md

Then, when you run glow without arguments will you can browse through your stashed documents. This is a great way to keep track of things that you need to reference often.

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"
# show local files only; no network (TUI-mode only)
local: true
# mouse support (TUI-mode only)
mouse: true
# use pager to display markdown
pager: true
# word-wrap at width
width: 80

🔒 Encryption: How It Works

Encryption works by issuing symmetric keys (basically a generated password) and encrypting it with the local SSH public key generated by the open-source charm library. That encrypted key is then sent up to our server. We can’t read it since we don’t have your private key. When you want to decrypt something or view your stash, that key is downloaded from our server and decrypted locally using the SSH private key. When you link accounts, the symmetric key is encrypted for each new public key. This happens on your machine and not our server, so we never see any unencrypted data.

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source

Issues
  • Added option to edit current document

    Added option to edit current document

    Implements charmbracelet/glow#182

    Allows the user to edit the current document by typing 'e'. Glow will search $PATH for a list of pre-defined command line text editors, giving priority to the command specified with $EDITOR if set. A temporary file is created with the contents of the current document, and the chosen text editor is used to edit it. If no changes are made when the editor exits, nothing happens. If changes are made, then:

    if the document is a local file, the edits are written to that file if the document is stashed, a new stash is created with the edits, and the old stash is deleted.

    It would be ideal to simply update the contents of a stash, but the charm API doesn't currently allow this. Deleting the selected stash has the side effect that, when the user returns to the list of files and tries to re-open the same document, the stash won't load. Restarting glow solves this and shows the newly created, updated stash.

    https://github.com/charmbracelet/charm/pull/13 creates a SetMarkdownBody() method to resolve this minor issue.

    This PR also adds a few status messages throughout the process. To that end, showStatusMessage() was updated to work as it was presumably intended. At present, it only ever displays "Stashed!" no matter what parameter is sent. This PR updates it so that you can display any message.

    opened by shitchell 12
  • Pager live preview

    Pager live preview

    A good additional feature would be a pager mode with a live preview, allowing to modify the file and preview its changes in real time (even better would be to have some sort of analogue of the synctex, but probably that's out of the scope of this tool)

    duplicate 
    opened by morpheusthewhite 10
  • regression: glow gets confused and outputs ansi gibberish under uxrvt

    regression: glow gets confused and outputs ansi gibberish under uxrvt

    I guess this isn't a glow issue but you never know...

    glow works perfectly under xterm, alacritty & wezterm, and when run without a direct path parameter.

    • tested against head 1f2b3671c715f4a84d8103f617ee35d821fb347b & 1.4.1
    • x11/rxvt-unicode on FreeBSD 13.0-RELEASE amd64
    • TERM=xterm-256color

    with pager set in glow config

    [email protected] /p/c/serenity> glow README.md 
    ^[]11;rgba:0000/0000/01ff/c800^[^[[3;1R
       Serenity  <------------- back in "nice" glow mode again
    ...
                    
    ...skipping...
    
    228;48;5;63;1mSerenity <------ oh dear the charm is leaking everywhere
    ;5;252m                                                                       
    r:                                               
    2m... gets worse and worse
    

    without pager

    [email protected] /p/c/serenity> glow README.md
    ^[]11;rgba:0000/0000/01ff/c800^[^[[3;1R
       Serenity  <--------- back in "nice" glow mode again                              
                                                                                  
    ...
                ## deploy via ansible                                                       
                                                                                  
      Read the  Makefile  to see exactly what roles/steps are taken behind the    
      scenes:                                                                     
                                                                                
        $ make facts sign serenity                                                
    
    <---------- perfect until the final lifeless gasp, whereupon coloured sputum attempts
    to bypass the terminal...
    [email protected] /p/c/serenity> 00[3;1R]11;rgba:0000/0000/01ff/c800[3;1R
    
    opened by dch 7
  • Unable to build glow on macOS

    Unable to build glow on macOS

    $ sw_vers
    ProductName:	Mac OS X
    ProductVersion:	10.15.3
    BuildVersion:	19D76
    
    $ go version
    go version go1.13.7 darwin/amd64
    

    I'm getting this error when I build glow on macOS:

    $ go get -u -ldflags "-s -w" github.com/charmbracelet/glow
    # github.com/charmbracelet/glamour/ansi
    go/src/github.com/charmbracelet/glamour/ansi/codeblock.go:110:3: unknown field 'Forward' in struct literal of type indent.Writer
    go/src/github.com/charmbracelet/glamour/ansi/heading.go:70:3: unknown field 'Forward' in struct literal of type indent.Writer
    go/src/github.com/charmbracelet/glamour/ansi/margin.go:37:3: unknown field 'Forward' in struct literal of type padding.Writer
    go/src/github.com/charmbracelet/glamour/ansi/margin.go:51:3: unknown field 'Forward' in struct literal of type indent.Writer
    go/src/github.com/charmbracelet/glamour/ansi/table.go:51:3: unknown field 'Forward' in struct literal of type indent.Writer
    
    opened by mikemadden42 7
  • Version parameter adds output string

    Version parameter adds output string "29;1R"

    When running the version parameter, additional output is created:

    $ glow --version
    glow version 1.4.0 (4f9ad67)
    $ 29;1R
    
    • TERM contains rxvt
    • This happens with --version and -v equally.
    bug 
    opened by Spreadcat 6
  • Make it aware of lowercase readme by default

    Make it aware of lowercase readme by default

    Make runner aware of readme.md as well. Some people prefer all files to be lowercased, including readme. Now it's required to pass such name explicitly, wasting time.

    enhancement 
    opened by StreetStrider 6
  • Detect terminal's width and limit default word-wrap setting to it

    Detect terminal's width and limit default word-wrap setting to it

    I am subjected to a scrolling problem.

    Immediately after :

    glow -p mydoc.md

    the head (first lines/pages) of the document is missing.

    I can't scroll up to the head.

    But if I scroll down, then up, I can get to the head, with missing characters at the start of the lines

    See screenshot in attachment (glow left, bat right)

    glow_vs_bat

    enhancement 
    opened by lofic 6
  • Arch Linux packages are not available

    Arch Linux packages are not available

    The README mentions that the package can be installed in Arch Linux with pacman -S glow. But it throws error target not found: glow. On the other hand, it seems that the packages glow and glow-bin were available at AUR at some point, but not anymore. Is the package still available in Arch repository or AUR?

    question 
    opened by onnyyonn 5
  • go get fails with go1.15.3

    go get fails with go1.15.3

    It seems like the Installation with go get fails at the moment on Arch Linux with go version go1.15.3 linux/amd64

    go get github.com/charmbracelet/glow
    # github.com/charmbracelet/glow/ui
    go/src/github.com/charmbracelet/glow/ui/ui.go:57:23: too many arguments in call to tea.NewProgram
            have (func() (tea.Model, tea.Cmd), func(tea.Msg, tea.Model) (tea.Model, tea.Cmd), func(tea.Model) string)
            want (tea.Model)
    go/src/github.com/charmbracelet/glow/ui/ui.go:211:3: cannot use m (type model) as type tea.Model in return argument:
            model does not implement tea.Model (missing Init method)
    go/src/github.com/charmbracelet/glow/ui/ui.go:218:14: impossible type assertion:
            model does not implement tea.Model (missing Init method)
    go/src/github.com/charmbracelet/glow/ui/ui.go:220:15: cannot use model literal (type model) as type tea.Model in return argument:
            model does not implement tea.Model (missing Init method)
    go/src/github.com/charmbracelet/glow/ui/ui.go:414:14: impossible type assertion:
            model does not implement tea.Model (missing Init method)
    
    opened by voest 5
  • Adding support for a GLAMOUR_STYLE environment variable

    Adding support for a GLAMOUR_STYLE environment variable

    A couple of CLI programs I use (e.g. https://github.com/sharkdp/bat#highlighting-theme) have support for defining the highlight/syntax theme via an environment variable. This PR adds similar functionality to Glow via a GLAMOUR_STYLE environment variable.

    I propose the variable be named GLAMOUR_STYLE and any program using the Glamour library can honor the same variable to make configurations portable (I briefly entertained the idea of checking the environment variable in the glamour package instead of in Glow since that would automatically add the functionality to any projects that use glamour but I wasn’t sure if that was a good fit).

    enhancement 
    opened by jessemillar 5
  • Config file

    Config file

    Hi, thanks for making this cool CLI app. The current dark theme doesn't suit with my terminal color scheme. Adding a feature to support customized color scheme would be nice. Maybe with parameter like fzf, or config file like alacritty, or .sublime-syntax file like bat.

    Related: #114

    enhancement 
    opened by dikiaap 5
  • Follow links

    Follow links

    Hello Devs

    Please make it possible to follow both filesystem links (/foo/bar) and weblinks. It would make the experience feel more complete. For example the TuxDocs project. Being able to follow the links inside the terminal would be awesome!

    opened by Reikimann 0
  • Sharing stashed documents

    Sharing stashed documents

    So, several documents seem to imply that stashed documents are shared once you link keys to your account.

    I used both the latest charm and glow release on 2 linux machines:

    • charm uses ed25519 keys stored in ~/.local/share/charm/cloud.charm.sh/
    • glow seems to generate new RSA keys directly in ~/.local/share/charm/
    • I tried symlinking the ed25519 keys charm created to ~/.local/share/charm/; glow then does not generate new keys, stashing seems to work, but sharing stashes still doesn't

    Am I missing something?

    opened by svengit 0
  • Some HTML tags don't work

    Some HTML tags don't work

    I was using superscript and subscript tags in my markdown file. I tried to preview with glow and noticed it hadn't rendered them correctly. Is this a limitation of the terminal? Or can it be made to work?

    markdown: 1 x 2<sup>0</sup> Expected behavior: 1 x 20 Actual behavior: 1 x 20

    opened by s0alqasim1d 1
  • Cannot find keygen package in charmbracelet/charm

    Cannot find keygen package in charmbracelet/charm

    While trying to use github.com/charmbracelet/glow/ui, go mod tidy outputs:

    	github.com/charmbracelet/glow imports
    	github.com/charmbracelet/glow/ui imports
            github.com/charmbracelet/charm/keygen: module github.com/charmbracelet/[email protected] found (v0.12.1), but does not contain package github.com/charmbracelet/charm/keygen
    

    So I found out an older version of charm (v0.8.6) does satisfy this dependency. However, the latest version does not. So to satisfy this I changed the import from github.com/charmbracelet/charm/keygen to github.com/charmbracelet/keygen and used the similar function.

    This is, I think, my first PR. Any tips would be welcome of course :)

    opened by yoeria 0
  • feat: update to latest charm

    feat: update to latest charm

    I think current version of glow is still using the rsa keys, so we prob want to migrate them to the ed15519 ones as well...

    or somehow force the old rsa ones 🤔

    thoughts?

    enhancement 
    opened by caarlos0 0
  • Option to ignore reference-style links

    Option to ignore reference-style links

    I use Markdown syntax when writing git commit messages, and I would love to use glow as a pager for git log. This works pretty well:

    git log --pretty="format:'## %s (%h)%n%n_%aN | %ah_%n%n%b'" | glow -p -w 80 -
    

    Except that I use reference-style links, to avoid breaking the flow of text when I need to read the log without the benefit of Markdown rendering:

    For example, this is a body paragraph with a [link to some docs][1]
    related to the changes in some commit.
    
    [1]: https://example.com
    

    This is fine for viewing a single commit, but if I pipe git log through glow as above, the URLs from the topmost commits get inserted into every commit message that includes a link with the same number. It would be really great if there were a flag I could use to leave these links as they are in the raw text!

    opened by rdnlsmith 0
Releases(v1.4.1)
Owner
Charm
We build tools to make the command line glamorous
Charm
Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❤️ Sponsor Install via nami nami install ma

TxThinking 3 Jun 2, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

杨英明 13 Jun 6, 2022
A terminal based preview tool for markdown 🍪

Smooth Smooth is a terminal based preview tool for markdown. Features Turning: turn next/previous slide Scroll: scroll up/down slide Search: search wo

ketsu chin 3 May 22, 2022
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Glamour Write handsome command-line tools with Glamour. glamour lets you render markdown documents & templates on ANSI compatible terminals. You can c

Charm 1.2k Jun 29, 2022
A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Michael Muré 241 Jun 5, 2022
A clean, Markdown-based publishing platform made for writers. Write together, and build a community.

WriteFreely is a clean, minimalist publishing platform made for writers. Start a blog, share knowledge within your organization, or build a community

WriteFreely 2.7k Jun 20, 2022
A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

null 39 May 3, 2022
The Markdown-based note-taking app that doesn't suck.

Notable I couldn't find a note-taking app that ticked all the boxes I'm interested in: notes are written and rendered in GitHub Flavored Markdown, no

Notable 20k Jun 30, 2022
Generate markdown formatted sprint updates based on the Jira tickets were involved in the given sprint.

Generate markdown formatted sprint updates based on the Jira tickets were involved in the given sprint.

Gábor Boros 2 Nov 15, 2021
Effortless customization for markdown-based SvelteKit blogs!

reece Effortless customization for markdown-based SvelteKit blogs! Installation Install using: One-Script Installation (Linux): curl -sfL https://gith

Aadhav Vignesh 0 Dec 11, 2021
Vtterm - An raw-mode vt100 screen reader

#VT100 TERMINAL This is a vt100 screen reader ( clone of jaguilar/v100 ) and inc

Navid YS 1 Feb 26, 2022
Parse data and test fixtures from markdown files, and patch them programmatically, too.

go-testmark Do you need test fixtures and example data for your project, in a language agnostic way? Do you want it to be easy to combine with documen

Eric Myhre 17 Jun 17, 2022
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Johannes Kaufmann 366 Jun 24, 2022
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

ZoomIO 21 Jun 16, 2022
Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Russ Ross 4.9k Jun 20, 2022
Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Jukka-Pekka Kekkonen 31 Nov 12, 2021
A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

goldmark A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.29. Motivation

Yusuke Inuzuka 2.2k Jun 28, 2022
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.

gofmtmd gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt. Installation $ go get github.com/po3rin/gofm

po3rin 90 Apr 3, 2022
Convert Microsoft Word Document to Markdown

docx2md Convert Microsoft Word Document to Markdown Usage $ docx2md NewDocument.docx Installation $ go get github.com/mattn/docx2md Supported Styles

mattn 545 Jun 21, 2022