Code Monkey home page Code Monkey logo

glow's Issues

Rerender-Mode

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

TUI doesn't respect `-w` flag

I'm running glow from brew: glow: stable 1.0.1

steps to reproduce:

  1. run: > glow -w 40 to pull up the TUI
  2. select a file to open
  3. page displays at max width, not the value provided to -w

Problem with GLIBC_2.32 on Ubuntu 19.10

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)

Requires go 1.13

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.

Why showing # in headers ?

Hi,

For H1 we don't see #:) But for H2, H3 we can see # :(
Why is that? Any option to see a normal formatting instead?

Screenshot

Screen Shot 2020-02-08 at 6 38 37 PM

Thanks :)

Is it possible to open links?

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.

Href Link issue

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.

Skärmavbild 2020-10-16 kl  13 37 28

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

Headers 2 - 6 not rendered correctly, just raw text

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

Output
image

Ignore Yaml Frontmatter

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?

Extraneous spaces?

When using glow to render markdowns, it seems like there are a lot of useless spaces at the end of lines. You can see in this screenshot (run with glow github.com/charmbracelet/glow | bat -A, where the blue dots are spaces):

maim-2019-12-23--14-35-38

Not working with style argument

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

exit status 1 when used with `most` PAGER

  1. brew install most
  2. PAGER='most' glow README.md -p
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!

glow has issues opening file on command line with colon

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.

glow doesn't use WithAutoPrefix

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)

Handle relative URLs

When fetching markdown from HTTP sources, complete relative URL references with the base-URL.

Version flag

It would be nice to run gold --version to know how up-to-date your version of the fast-moving gold binary is.

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

`glow-bin` on arch linux

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.

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

Docker version (PR idea)

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

Docker hub

https://hub.docker.com/r/devmtl/glow/tags

Run

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)

Dockerfile

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}"

Only prints escape code on win 10

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.

Coloring should be disabled if output is not a TTY

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.

go get github.com/charmbracelet/glow complains about termenv_unix.go

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)

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

Add Line Numbers

Bat has this feature and it's really useful. Would it be possible to add line numbers with the output similar to bat?

Open in editor

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.

markdown dialect?

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?

Installing with go get fails with `undefined: aurora.Reset` in glamour

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

[enhancement] add file monitor support

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.

pager

As implemented, glow lacks an inbuilt pager, and piping to an external pager like less or bat removes highlighting.

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)

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.