Glow: Render Markdown on the CLI
github.com
github.com
markdown () {
pandoc $1 | lynx -stdin
}
usage: $ markdown README.md
I don't often use pandoc or lynx so might check out glow instead, but I thought some of you might find this approach simpler in case you already have these tools installed.Your approach is more sensible, I had fun playing with the lua script though. Pandoc will spit out a reference script that formats the output as html so it it pretty easy to work off of
(You might question why a log file viewer needs markdown support... It's used mainly to make the builtin help text look nicer. But, it can also be used in other places, like adding comments to log messages and generating reports. It's even used to implement an interactive tutorial[2].)
[1] - https://lnav.org/2022/08/06/markdown-support.html [2] - https://lnav.org/2022/09/01/playground.html
you don't have to use their cloud, but they have one if you want to, and I'm sure it works nice with their stuff.
One thing that would be cool is image support for terminals that support them.
I'm also curious (tangentially) if there are any terminals that support different fonts and sizes (at the same time)?
edit: yep. see https://en.wikipedia.org/wiki/Vttest
In case anyone is interested, I just checked, and xterm supports it, terminal on ubuntu does not, nor does iterm2 on mac nor termux on android
https://github.com/cli/cli/blob/e876b229634b02d40bdfbb15844d...
Glow does too much. I don't care about using their cloud, a new pager, or a TUI for that matter. Just render Markdown and let me view it with my pager of choice.
E.g. is it only changing the text’s color / font style? Or is it also doing something more, like positioning or spacing?
What do you feel is uniquely appealing about UIs in those different categories that has your excitement pinging between them?
terminal: beautiful simplicity & efficiency -- everything is a stream of bytes, output is characters displayed on a regular grid
web: bang-for-buck experience -- hard to beat for middling interactivity plus high development velocity
native: maxed out capacity for experience & interactivity
less --version
less 608 (PCRE2 regular expressions)
it also looks like it has a `-p` option for a pager
> 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.
but `glow -p file.md` is working great! thanks