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

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

Owner
Charm
We build tools to make the command line glamorous
Charm
Comments
  • 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.

  • 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)

  • Add option to edit current document

    Add option to edit current document

    Implements charmbracelet/glow#182

    Allows the user to edit the current document by typing 'e'. If $EDITOR is set, a temporary file is created with the contents of the current document, and the specified editor is used to open 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.

  • Won't Display Properly

    Won't Display Properly

    I've used Glow on my previous machine and I enjoy it. I just installed on my new machine and it looks like this. Any idea why? Sorry if this is not the right place for this.

    image

  • Charm colourscheme does not work within tmux

    Charm colourscheme does not work within tmux

    I am loving using glow, but when I run it inside Tmux the colour scheme is mangled.

    I am running MacOS big sur, in Iterm2 with the solarized dark scheme. I have added set -g default-terminal "screen-256color" to my .tmux.conf but, sadly, that does not fix the problem. Nor does setting glow -s dark.

    Any suggestions? Screenshot 2021-12-10 at 19 44 45 !

  • docs: streamline install instructions

    docs: streamline install instructions

    Add a note to just use go install for installation.

    Perhaps obvious, but I tend to simply use go as a package manager for golang projects.

    Edit: Also, this is just super nice; been looking for a good terminal markdown viewer and this renders beautifully, thanks!

  • 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

    dch@wintermute /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

    dch@wintermute /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...
    dch@wintermute /p/c/serenity> 00[3;1R]11;rgba:0000/0000/01ff/c800[3;1R
    
  • 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
    
  • 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

  • Garbled output with -p and most

    Garbled output with -p and most

    I want to read a markdown file pager-style, not by scrolling in the shell. So I use -p; most is my pager. Compare:

    glow -p README.md: image

    glow README.md: image

    glow README.md | most image

    Workaround: glow . or glow --all and select the file.

    Not sure whether the problem is actually with glow, not most (most does show colors in other cases, e.g. when showing man pages). So I guess I'll spin this as a feature request: please add an option (that I can make the default through the config file) that opens the given file in "pager mode" directly (without the external pager).

    ❯ glow --version
    glow version 1.4.1 (4863f57)
    ❯ most --version
    MOST version 5.0.0 (S-Lang version 2.3.2)
     *Note: This executable was compiled against S-Lang 2.3.1
    
  • Optionally remove closing message

    Optionally remove closing message

    Lovely tool & sorry for the weird request but I wrap this tool in the CLI environment with another name that is not glow. So, when users close the tool, they see "Thanks for using Glow!" which is confusing. Would it be possible to turn this off? Thanks :pray:

  • `glow github.com/owner/repo` doesn't work with lowercase

    `glow github.com/owner/repo` doesn't work with lowercase "readme.md" file

    glow https://github.com/danielwerg/r6api.js returns Error: can't find README in GitHub repository

    Looks like it is because glow looks strictly for README and README.md and nothing else. https://github.com/charmbracelet/glow/blob/d9bf3b8ee89072cdec42af6d938a1bef0393c748/main.go#L31 Could it be solved by just adding readme.md to that ^ list?

  • Cygwin build

    Cygwin build

    Trying to install Glow on Cygwin but no build is working.. Is it possible to use it on Cygwin and if so - how to install it?

    Getting "zsh: exec format error: glow" error

  • Automatically open README.md

    Automatically open README.md

    As a prolific CLI spelunker, I would like glow when executed with no arguments, to open README.md if it exists in the current working directory.

    Otherwise, send me to the home model (local/stashed/news).

    (I would have tagged this with a feature request label if one was available)

  • Code within quotes doesn't render

    Code within quotes doesn't render

    Hi, and thanks for the cool tool!

    It seems like Glow cannot handle code blocks within blockquotes. For example, consider the following document:

    ```go
    fmt.Println("normal code")
    ```
    
    > ```go
    > fmt.Println("code within quote")
    > ```
    
    1.  List.
    
    2.  ```go
        fmt.Println("code within list")
        ```
    
    3.  > Quote within list.
    
    4.  > ```go
        > fmt.Println("code within quote within list")
        > ```
    

    Consider the difference between how Dingus renders it and how Glow renders it:

    Dingus Glow v1.4.1

    Screenshot at 2022-12-10 16-05-33

    Screenshot at 2022-12-10 16-06-29

    Using Debian 11 with MATE Terminal v1.24.1. Setting XTERM to something like xterm-256color doesn't seem to matter.

Markdown - Markdown converter for golang

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

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

Dec 18, 2022
A terminal based preview tool for markdown 🍪
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

May 22, 2022
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
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

Jan 1, 2023
A markdown renderer package for the terminal
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

Nov 25, 2022
A clean, Markdown-based publishing platform made for writers. Write together, and build a community.
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

Jan 4, 2023
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

Dec 20, 2022
The Markdown-based note-taking app that doesn't suck.
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

Jan 2, 2023
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.

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

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

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

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

Oct 31, 2022
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.
⚙️ 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

Jan 6, 2023
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.
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

Dec 19, 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

Jan 8, 2023
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

Oct 23, 2022
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

Dec 29, 2022
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.
: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

Oct 31, 2022
Convert Microsoft Word Document to Markdown
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

Jan 4, 2023