diff --git a/highbeam b/highbeam index 2119a56..c4dfaa6 100755 --- a/highbeam +++ b/highbeam @@ -8,20 +8,21 @@ syntax highlighter. Example rules: ( ~/.highbeamrc ) -------------------- RULES=( - "[0-9]" "$C" # Show numbers with Cyan color. NOTE: since the colors are represented with numbers, having this later in the rules will break coloring! + "[0-9]" "$c" # Show numbers with Cyan color. NOTE: since the colors are represented with numbers, having this later in the rules will break coloring! "$USER[ ]\+$USER" "$BGC$BLACK" # Use quotes to have rules with spaces. This colors the "ls -la" usernames. background cyan, black text - status "$G" # simple word matching, coloring green - "^d[^ ]*" "$H$G" # color words at the beginning of line, starting with d. color bright green - "q.\{0,3\}r" "$H$Y" # q*r with maximum 3 characters in between. color bright yellow + status "$g" # simple word matching, coloring green + "^d[^ ]*" "$G" # color words at the beginning of line, starting with d. color bright green + "q.\{0,3\}r" "$Y" # q*r with maximum 3 characters in between. color bright yellow ) -------------------- Rules can be also exressed as a space separated list variable: export HB_RULES='\''"[0-9]" "$C" "g" "$Y"'\'' HB_RULES are appended to other rules -Color variables: $R $G $B $Y $M $C $W $BLACK -Modify to bright version by prefixing with $H (e.g. $H$G) -Background colors: $BGR $BGG $BGB $BGY $BGC $BGM $BGW +Bright colors: $R $G $B $Y $M $C $W $K +Dark colors: $r $g $b $y $m $c $w $k +Modify to bright version by prefixing with $H (e.g. $H$g) +Background colors: $BR $BG $BB $BY $BC $BM $BW Usage: highbeam [-c] [-h] [-f config] -c Be case sensitive @@ -38,24 +39,32 @@ H="${E}1m" Z="${E}0m" # list of text colors: -BLACK="${E}30m" -R="${E}31m" -G="${E}32m" -B="${E}34m" -Y="${E}33m" -M="${E}35m" -C="${E}36m" -W="${E}37m" +K="${E}1;30m" +R="${E}1;31m" +G="${E}1;32m" +B="${E}1;34m" +Y="${E}1;33m" +M="${E}1;35m" +C="${E}1;36m" +W="${E}1;37m" +k="${E}30m" +r="${E}31m" +g="${E}32m" +b="${E}34m" +y="${E}33m" +m="${E}35m" +c="${E}36m" +w="${E}37m" # list of BG colors: -BGR="${E}41m" -BGG="${E}42m" -BGB="${E}44m" -BGY="${E}43m" -BGM="${E}45m" -BGC="${E}46m" -BGW="${E}47m" +BR="${E}41m" +BG="${E}42m" +BB="${E}44m" +BY="${E}43m" +BM="${E}45m" +BC="${E}46m" +BW="${E}47m" CONF_FILE=~/.highbeamrc diff --git a/reporting/md-color b/reporting/md-color new file mode 100755 index 0000000..d73c9c4 --- /dev/null +++ b/reporting/md-color @@ -0,0 +1,32 @@ +#!/bin/bash +function helpexit() { + echo "Colorify a markdown document" + echo "Give filename(s) as the argument" + echo " Depends on highbeam " + exit +} +[[ -z "$1" ]] && helpexit +[[ "$1" = "-h" ]] && helpexit + +export HB_RULES='"^\s*\*.*" "$y" \ +"^[[:space:]]*[0-9]\+\..*" "$y" \ +"^#.*" "$W" \ +"^\s\s\s\s[^\*0-9].*" "$c" \ +"\`[^[[:space:]]]*[^\`]\+\`" "$c" \ +"\[[^]]\+\]([^)]\+)" "$B" \ +"\*[^[[:space:]]]*[^\*]\+\*" "$H" \ +"_[^[[:space:]]]*[^\_]\+_" "$H" \ +"<[^>]\+>" "$K" \ +' + +# * bullets +# 1. ordered list +# ## Headers +# code block +# code inline +# [links](URL) +# *bold* +# _bold_ +# <> tags +cat "$@" | highbeam + diff --git a/reporting/md-toc b/reporting/md-toc new file mode 100755 index 0000000..4ec3af1 --- /dev/null +++ b/reporting/md-toc @@ -0,0 +1,19 @@ +#!/bin/bash +function helpexit() { + echo "Print out TOC of a markdown document" + echo "Give filename(s) as the argument" + echo " -n to number TOC elements instead of bullet" + exit +} +[[ -z "$1" ]] && helpexit +[[ "$1" = "-h" ]] && helpexit +[[ "$1" = "-n" ]] && { + NUMBER=1 + shift +} + +[[ "$NUMBER" -eq 1 ]] && { + grep ^# "$@" | sed -e 's,^#,1.,' -e ':loop' -e 's,1.#, 1.,' -e 't loop' | pandoc -t markdown_strict +} || { + grep ^# "$@" | sed -e 's,^#,*,' -e ':loop' -e 's,*#, *,' -e 't loop' +} diff --git a/reporting/md-view b/reporting/md-view new file mode 100755 index 0000000..0728227 --- /dev/null +++ b/reporting/md-view @@ -0,0 +1,16 @@ +#!/bin/bash +function helpexit() { + echo "View a markdown document" + echo "Give filename(s) as the argument" + echo " Depends on pandoc and lynx " + exit +} +[[ -z "$1" ]] && helpexit +[[ "$1" = "-h" ]] && helpexit + +tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/markdown$$.html +trap "rm -f $tempfile" 0 1 2 5 15 + + +cat "$@" | pandoc -s > "$tempfile" +lynx -force_html "$tempfile"