#!/usr/bin/env bash
# -*- coding: utf-8 -*-
cat ()
{
# Font: http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/
if [ ! -t 0 ];then
file=/dev/stdin
elif [ -f $1 ];then
file=$1; shift
else
echo "usage: $0 code.c or e.g. head code.c|$0"
exit 1
fi
if [ ${file: -3} == ".md" ] || [ ${file: -3} == ".mkd" ]; then
marked $file | lynx -stdin
else
pygmentize -g -f terminal256 -O style=native "$file" | perl -lne 'print $., " ", $_'
fi
}
cat replacement ( bash function ) with python pygmentize for syntax highlighting
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.