charmbracelet / glow Goto Github PK
View Code? Open in Web Editor NEWRender markdown on the CLI, with pizzazz! 💅🏻
License: MIT License
Render markdown on the CLI, with pizzazz! 💅🏻
License: MIT License
To make it usable as preview option for markdown written in eg vim, it would be nice to have a special mode where the markdown file gets reloaded on every change. I tried running glow in watch, which didn't worked. Maybe there is already another option? If not, thats a feature request, this would be pretty neat in i3 :)
Would be awesome if the markdown notes could be synchronized with Nextcloud Notes (see API documentation) 🙂
I'm running glow from brew: glow: stable 1.0.1
steps to reproduce:
> glow -w 40
to pull up the TUI-w
We can't use less
on Windows for obvious reasons.
Hi,
I tried installing the file glow_1.0.0_linux_amd64.deb
, but:
$ sudo dpkg -i glow_1.0.0_linux_amd64.deb
Selecting previously unselected package glow.
(Reading database ... 297288 files and directories currently installed.)
Preparing to unpack glow_1.0.0_linux_amd64.deb ...
Unpacking glow (1.0.0) ...
Setting up glow (1.0.0) ...
$ glow --version
glow: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by glow)
As of today latest version on Ubuntu 19.10 is 2.30-0ubuntu2.2
(glow
v0.2.0 worked fine)
convert terminal output to html and css
Installing on Ubuntu 18.04, which provides go 1.10.4 gives the error:
package crypto/ed25519: unrecognized import path "crypto/ed25519" (import path does not begin with hostname)
which after some quick searching means that you need to have go 1.13 for that particular line to work.
Is it possible to somehow follow links? I have a lot of notes that are linked to each other (Zettelkasten style) and was wondering if I could use this viewer to render them.
When starting gold
with a directory as an argument, try to find the preferred README in it, as we do for GitHub.
Not sure if this is Glow or Hyper term misbehaving.
Highlighting and styling works correctly.
The dot is included in the link when clicking it. making the URL incorrect.
as you can see, the link is correctly highlighted, the dot there is white and not part of the highlighted section.
but the actual link content incorrectly includes the dot
making the URL incorrect when clicking it
Glow is only renders header 1, for example # Header1
, correctly. The rest of headers 2 through 6 render as raw text.
README.md example
# Heading 1
This is text below heading 1
## Heading 2
This is text below heading 2
### Heading 3
This is text below heading 3
#### Heading 4
This is text below heading 4
##### Heading 5
This is text below heading 5
###### Heading 6
This is text below heading 6
Add FreeBSD builds to the next release.
Nothing complicated needed, I think: we should just tell users that we're having trouble parsing their JSON file specifically.
I have md
and rmd
files that have frontmatter written in yaml
:
---
title: something
author: someone
#commented-out:
# option: value
---
# heading
text
glow
treats frontmatter as regular markdown and renders commented out entries as headings (sometimes).
I don't think that frontmatter is in the markdown spec, but it is well used. Can you ignore, or perhaps, sprinkle some of that "pizzazz" onto it?
These don't work:
gold -s dark.json test.md
gold --style dark.json github.com/muesli/beehive
(Gold says: Error: invalid character '"' after object key:value pair
)
But these work:
gold test.md
gold github.com/muesli/beehive
Error: exit status 1
Usage:
glow SOURCE [flags]
Flags:
-h, --help help for glow
-p, --pager display with pager
-s, --style string style name or JSON path (default "dark")
--version version for glow
-w, --width uint word-wrap at width (default 100)
It's not clear to me why this doesn't work. I've been using most
as my pager for years.
Thanks!
All,
This is an odd one and perhaps is my fault (my shell could be set up incorrectly, for example). Still, I have a wiki on GitHub that has pages with colons in their name. So when I look at a checkout:
$ ls -1
Home.md
Workflow:-Feature-Development.md
Workflow:-Science-Development.md
But when I try to use glow
on one of the workflow files:
$ glow Workflow:-Feature-Development.md
Error: workflow is not a supported protocol
Usage:
glow SOURCE [flags]
glow [command]
Available Commands:
help Help about any command
stash Stash a markdown
Flags:
-a, --all show system files and directories (TUI-mode only)
-h, --help help for glow
-p, --pager display with pager
-s, --style string style name or JSON path (default "auto")
-v, --version version for glow
-w, --width uint word-wrap at width
Use "glow [command] --help" for more information about a command.
Is there a way to open this file and not trigger the protocol check? I've tried various quoting, but I haven't gotten anything to work for me.
Note, I can just run glow
in this directory and use the "startup page", I just wondered if I was doing something else wrong.
The change made in charmbracelet/glamour#64 introduced the WithAutoStyle()
method, but that isn't used here. As a result, if you don't pass an explicit style name it will use auto
, which isn't a default style and throws an error. With a fresh install via go get
:
> glow README.md
Error: auto: style not found
Usage:
glow SOURCE [flags]
Flags:
-h, --help help for glow
-p, --pager display with pager
-s, --style string style name or JSON path (default "auto")
-v, --version version for glow
-w, --width uint word-wrap at width (default 100)
As per https://twitter.com/moderat10n/status/1209137416700719106 it would be nice to include example.md containing the text in the PNG file. This would allow comparison and reference testing.
When fetching markdown from HTTP sources, complete relative URL references with the base-URL.
It would be nice to run gold --version
to know how up-to-date your version of the fast-moving gold
binary is.
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)
please add an option to force colors, even when outputted through pipe
Would it be possible to get a glow-bin AUR package? It's annoying installing go every time I want to build a go package from the AUR, especially since go is quite large.
I really like the color theme in the example.png , but I could not find it searching online.
What's its name?
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.
I made a docker image out of it. It could be optimized but it's good enough at the moment :) It's only 11MB
Let me know if you want a PR
https://hub.docker.com/r/devmtl/glow/tags
input_2=CHANGELOG.md
docker run --rm -it \
-v $(pwd):/sandbox \
-w /sandbox \
devmtl/glow:0.2.0 glow ${input_2}
See output: #139 (comment)
ARG VERSION="0.2.0"
ARG APP_NAME="glow"
ARG GIT_PROJECT_NAME="glow"
ARG GIT_REPO_SOURCE="https://github.com/charmbracelet/glow"
# ----------------------------------------------
# REQUIRED BY OUR GITHUB ACTION CI
# ----------------------------------------------
ARG ALPINE_VERSION="3.11"
# ----------------------------------------------
# STAGE: BASE IMAGE VERSIONNING LAYER
# ----------------------------------------------
FROM alpine:${ALPINE_VERSION} AS myalpine
FROM golang:alpine${ALPINE_VERSION} AS mygolang
# Credit to Tõnis Tiigi / https://bit.ly/2RoCmvG
# ----------------------------------------------
# STAGE: ALPINEBASE LAYER
# ----------------------------------------------
FROM myalpine AS alpinebase
ARG APP_NAME
ARG VERSION
ARG ALPINE_VERSION
ARG GIT_REPO_DOCKERFILE
ARG GIT_REPO_SOURCE
ENV APP_NAME="${APP_NAME}"
ENV VERSION="${VERSION}"
ENV GIT_REPO_SOURCE="${GIT_REPO_SOURCE}"
ENV ALPINE_VERSION="${ALPINE_VERSION}"
ENV LANG=en_US.utf8 \
TERM=xterm-256color
# Install basics
RUN set -eux && apk --update --no-cache add \
tini
COPY hello.md /usr/local/bin/hello.md
WORKDIR /usr/local/bin
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "glow", "/usr/local/bin/hello.md" ]
# ----------------------------------------------
# STAGE: BUILDER LAYER
# ----------------------------------------------
FROM mygolang AS gobuilder
ARG APP_NAME
ARG VERSION
ARG GIT_REPO_SOURCE
ENV APP_NAME="${APP_NAME}"
ENV VERSION="${VERSION}"
ENV GIT_REPO_SOURCE="${GIT_REPO_SOURCE}"
# Install common utilities
RUN set -eux && apk --update --no-cache add \
bash wget curl git nano openssl ca-certificates upx
# Compile Go app
RUN set -eux && \
git clone "${GIT_REPO_SOURCE}" --depth 1 && \
cd "${APP_NAME}" && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /usr/local/bin/"${APP_NAME}"
# Compress binary
RUN set -eux && \
upx /usr/local/bin/"${APP_NAME}" && \
upx -t /usr/local/bin/"${APP_NAME}"
# ----------------------------------------------
# STAGE: FINAL
# ----------------------------------------------
FROM alpinebase AS final
COPY --from=gobuilder /usr/local/bin/"${APP_NAME}" /usr/local/bin/"${APP_NAME}"
This doesn’t work:
gold -w 40 gold github.com/muesli/beehive
(Gold spits out a gnarly log message)
But this works great:
gold -w 40 https://raw.githubusercontent.com/muesli/beehive/master/README.md
I typed > .\glow.exe
in powershell. Instead of the README.md text, it output the following sequence:
?[1;38;5;228;48;5;63m?[0m?[1;38;5;228;48;5;63m?[0m ?[1;38;5;228;48;5;63m ?[0m?[1;38;5;228;48;5;63mGlow?[0m?[1;38;5;228;48;5;63m ?[0m?[38;5;252m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[38;5;252m ?[0m?[0m
[... and a lot more of this]
To make sure it's not an issue with powershell, I tried again in cmd.exe and produced the same result.
Looks like ANSI escape code is broken on win 10? Or is it just my machine.
It's sort of opposite the point of this library, but with things like the auto-fetch-from-github functionality users could find themselves doing something like the following:
gold -s dark.json https://github.com/muesli/beehive | less
…which of course would appear littered with ASCII escape codes.
On debian testing:
$ go get github.com/charmbracelet/glow
# github.com/muesli/termenv
go/src/github.com/muesli/termenv/termenv_unix.go:79:9: readfds.Set undefined (type unix.FdSet has no field or method Set)
go/src/github.com/muesli/termenv/termenv_unix.go:96:13: readfds.IsSet undefined (type unix.FdSet has no field or method IsSet)
$ 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
Show them what we got 😆
Hi, when I run glow to view a local markdown file. It connects to id.charm.sh. Why is it? and how to disable this behavior?
Bests,
Bat has this feature and it's really useful. Would it be possible to add line numbers with the output similar to bat?
When viewing a file with less, one can press v
to open the file in the editor. Adding this feature to glow would be great.
Hi there,
Awesome project so far, but I can only use it in prod if it supports commonmark.
I can't find anything about the supported markdown specs. Does it also support commonmark?
See for example : BAT_STYLE for https://github.com/sharkdp/bat
GLOW_STYLE ?
I'm trying to install glow through go get
:
$ go get github.com/charmbracelet/glow
# github.com/charmbracelet/glamour/ansi
/data/go/src/github.com/charmbracelet/glamour/ansi/baseelement.go:99:9: undefined: aurora.Reset
My go version:
$ go version
go version go1.12.12 linux/amd64
I like using glow to see an output preview of my markdown files, however it would be nice to have a flag that will detect changes to the open file and reload the file into glow while it is opened in a pager.
As implemented, glow
lacks an inbuilt pager, and piping to an external pager like less
or bat
removes highlighting.
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)
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.