markdown tools
This commit is contained in:
53
highbeam
53
highbeam
@@ -8,20 +8,21 @@ syntax highlighter.
|
|||||||
Example rules: ( ~/.highbeamrc )
|
Example rules: ( ~/.highbeamrc )
|
||||||
--------------------
|
--------------------
|
||||||
RULES=(
|
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
|
"$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
|
status "$g" # simple word matching, coloring green
|
||||||
"^d[^ ]*" "$H$G" # color words at the beginning of line, starting with d. color bright green
|
"^d[^ ]*" "$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
|
"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:
|
Rules can be also exressed as a space separated list variable:
|
||||||
export HB_RULES='\''"[0-9]" "$C" "g" "$Y"'\''
|
export HB_RULES='\''"[0-9]" "$C" "g" "$Y"'\''
|
||||||
HB_RULES are appended to other rules
|
HB_RULES are appended to other rules
|
||||||
|
|
||||||
Color variables: $R $G $B $Y $M $C $W $BLACK
|
Bright colors: $R $G $B $Y $M $C $W $K
|
||||||
Modify to bright version by prefixing with $H (e.g. $H$G)
|
Dark colors: $r $g $b $y $m $c $w $k
|
||||||
Background colors: $BGR $BGG $BGB $BGY $BGC $BGM $BGW
|
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]
|
Usage: highbeam [-c] [-h] [-f config]
|
||||||
-c Be case sensitive
|
-c Be case sensitive
|
||||||
@@ -38,24 +39,32 @@ H="${E}1m"
|
|||||||
Z="${E}0m"
|
Z="${E}0m"
|
||||||
|
|
||||||
# list of text colors:
|
# list of text colors:
|
||||||
BLACK="${E}30m"
|
K="${E}1;30m"
|
||||||
R="${E}31m"
|
R="${E}1;31m"
|
||||||
G="${E}32m"
|
G="${E}1;32m"
|
||||||
B="${E}34m"
|
B="${E}1;34m"
|
||||||
Y="${E}33m"
|
Y="${E}1;33m"
|
||||||
M="${E}35m"
|
M="${E}1;35m"
|
||||||
C="${E}36m"
|
C="${E}1;36m"
|
||||||
W="${E}37m"
|
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:
|
# list of BG colors:
|
||||||
BGR="${E}41m"
|
BR="${E}41m"
|
||||||
BGG="${E}42m"
|
BG="${E}42m"
|
||||||
BGB="${E}44m"
|
BB="${E}44m"
|
||||||
BGY="${E}43m"
|
BY="${E}43m"
|
||||||
BGM="${E}45m"
|
BM="${E}45m"
|
||||||
BGC="${E}46m"
|
BC="${E}46m"
|
||||||
BGW="${E}47m"
|
BW="${E}47m"
|
||||||
|
|
||||||
|
|
||||||
CONF_FILE=~/.highbeamrc
|
CONF_FILE=~/.highbeamrc
|
||||||
|
|||||||
32
reporting/md-color
Executable file
32
reporting/md-color
Executable file
@@ -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
|
||||||
|
|
||||||
19
reporting/md-toc
Executable file
19
reporting/md-toc
Executable file
@@ -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'
|
||||||
|
}
|
||||||
16
reporting/md-view
Executable file
16
reporting/md-view
Executable file
@@ -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"
|
||||||
Reference in New Issue
Block a user