Readit News logoReadit News
rpastuszak · 3 years ago
Here's the snippet I'm using:

    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.

version_five · 3 years ago
Hey, you reminded me, I once experimented with pandoc's conversion script- you can write a lua script that handles the different markdown styles - to just output escape sequences for different colors or bold/italics depending on the header level, so that you could just translate the markdown into something prettier in your shell.

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

luckman212 · 3 years ago
You need quotes around "$1" otherwise `markdown "my file.md"` won't work because of the whitespace.
rpastuszak · 3 years ago
ah, good catch, cheers!
tempodox · 3 years ago
And you could swap pandoc with multimarkdown. Achieves the same.
xcdzvyn · 3 years ago
But it doesn't have pizzazz! :-)
aaws11 · 3 years ago
cheeky chooky
tstack · 3 years ago
Rendering markdown in the terminal[1] was also recently added to the Logfile Navigator (https://lnav.org). It was partially inspired by Glow. There are some extra features in lnav's implementation, like a breadcrumb bar so that you can jump to different sections of the document.

(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

kickingvegas · 3 years ago
"Glow works with the Charm Cloud to allow you to store any markdown files in your own private collection." So are we to presume that Charm Cloud is always going to be an intermediary between the user and their private collection? Seems like a vulnerable position place to be when using sensitive info captured in Markdown.
chucky_z · 3 years ago
Run it yourself if you’re concerned =)

https://github.com/charmbracelet/charm

naikrovek · 3 years ago
render any markdown you like, charm cloud or not.

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.

kickingvegas · 3 years ago
OTOH, I can already use pygmentize + less (via a .lessfilter) to render Markdown in the terminal. https://pygments.org/docs/cmdline/
IanCal · 3 years ago
Interesting, I'm a bit concerned about pushing arbitrary things to a third party on just pressing s though. I know there's talk of encryption but still, that's a much bigger thing than just rendering markdown.
cglong · 3 years ago
It looks like there's a config flag that disables all network activity, including to/from their cloud.
version_five · 3 years ago
Vim already does a lot of this between syntax highlighting and the fact that markdown is designed to be readable as text. I think it's an interesting space though.

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

naikrovek · 3 years ago
2x wide and 2x tall fonts were commonly supported on old terminals, though not commonly used. I bet xterm supports both today.

edit: yep. see https://en.wikipedia.org/wiki/Vttest

version_five · 3 years ago
Very interesting, thanks!

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

1-more · 3 years ago
I have a very nice tool for checking out the GitHub pull requests I'm assigned to review that uses this to preview the description. Way nicer than anything else I tried in that it can do emojis (not sure if they're encoded as shortcodes or what), tables, etc.
petepete · 3 years ago
GitHub's command line tool does a pretty good job of this, it does emoji too.
1-more · 3 years ago
I use that to get the markdown in the list of PRs assigned to me, then I use fzf (fuzzy finder) to choose between them with Glow for the previewing. I think I tried previewing the PR with GH and because it would fetch each PR description anew it wasn't good for arrowing between the PRs like I wanted.
ehershey · 3 years ago
It uses the same library as glow (glamour) -

https://github.com/cli/cli/blob/e876b229634b02d40bdfbb15844d...

dotancohen · 3 years ago
I'd love to see how the markup is actually rendered. The README has an animated gif, but it goes by so fast that I really can't see how anything is rendered. Screenshots would be fine for this purpose, why the bling?
bubuanabelas · 3 years ago
A few years ago I wrote markcat, a cli toot to process markdown but more focused on readability. To this day I do `markcat README.md` a lot .

https://github.com/BubuAnabelas/markcat/

imiric · 3 years ago
Thanks, this looks much better.

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.