~chambln/gmi

ref: ba42a734 gmi/contrib/gemtext.awk -rwxr-xr-x 244 bytes
ba42a734Gregory Chamberlain Copy $AWK_GEMTEXT into contrib/gemtext.awk 16 days ago
                                                                                
1
2
3
4
5
6
7
#!/usr/bin/awk -f

/^```/ { pre = (pre + 1) % 2; next }
pre { $0 = "    \033[32m" $0 }
! pre { sub("^##?#?", "&\033[1m") || sub("^>", "&\033[33m") }
! pre && sub("^=>", "") { $1 = "[" ++i "] \033[4m\033[34m" $1 "\033[m" }
{ print $0 "\033[m" }