`code` and ```code block``` support
Ted Unangst tedu@tedunangst.com
Wed, 08 May 2019 13:08:29 -0400
2 files changed,
9 insertions(+),
1 deletions(-)
M
docs/manual.txt
→
docs/manual.txt
@@ -3,7 +3,11 @@ Instructions for running of the honk.
-- posting -Should work as expected. Supports **bold** and *italics*. +Should work as expected. + +Limited markdown support: + **bold** and *italics* + `code` and ```code block``` Large images are rescaled and reduced.
M
fun.go
→
fun.go
@@ -156,10 +156,14 @@ }
var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?']+)\*\*($|\W)`) var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?']+)\*($|\W)`) +var re_bigcoder = regexp.MustCompile("```((?s:.*?))```") +var re_coder = regexp.MustCompile("`(.*?)`") func markitzero(s string) string { s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3") s = re_italicer.ReplaceAllString(s, "$1<i>$2</i>$3") + s = re_bigcoder.ReplaceAllString(s, "<pre><code>$1</code></pre>") + s = re_coder.ReplaceAllString(s, "<code>$1</code>") return s }