Code Monkey home page Code Monkey logo

Comments (5)

djsnipa1 avatar djsnipa1 commented on May 17, 2024 5

Just wanted to chime in...glow works great like this:

add this to your ~/.bashrc, ~/.zshrc, or ~/.aliases file:

# view .md files in terminal with glow
mdless() {
    glow "$@" -s dark | less -r
}

Then when you close and re-open your terminal, just type

mdless README.md

or whatever filename you want to be paged.

from glow.

SergeyKasmy avatar SergeyKasmy commented on May 17, 2024 4

You could automatically use the pager from $PAGER (or less by default) if the content doesn't fit on the screen. A-la how systemctl or git log work. And maybe even a flag to force pager off? Again, just like git --no-pager log

from glow.

muesli avatar muesli commented on May 17, 2024 2

glow detects not printing to a terminal and disables the default styling. You can however enforce it:

glow -s dark | less -r

from glow.

davekaufman avatar davekaufman commented on May 17, 2024

Duly noted, with my thanks.

I will note that this behavior seems inconsistent to me.
I would argue that a separate flag should enable sending of control chars through the pipe - either that, or turn off styling by default - either would result in more predictable behavior.

Either way, cool utility, thanks for making it.

from glow.

muesli avatar muesli commented on May 17, 2024

I've added the -p flag to glow, which automatically pipes the output to your $PAGER (or less -r if that's not set).

from glow.

Related Issues (20)

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.