Hacker News new | ask | show | jobs
by dhamidi 2856 days ago
Actually plain less works quite well when using filters:

  #!/bin/bash
  # ~/.lessfilter
  case $1 in
    *.md) view-md $1;;
    *.json) jq -C . $1;;
    *) pygmentize $1;;
  esac
Where view-md is just a thin wrapper around tty-markdown[1]:

  #!/usr/bin/env ruby
  
  require 'tty-markdown'
  
  puts TTY::Markdown.parse(ARGF.read, colors: 256)

[1]: https://github.com/piotrmurach/tty-markdown