`code` and ```code block``` support
This commit is contained in:
parent
f1b4c45088
commit
c191622652
|
@ -3,7 +3,11 @@ Instructions for running of the honk.
|
||||||
|
|
||||||
-- posting
|
-- 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.
|
Large images are rescaled and reduced.
|
||||||
|
|
||||||
|
|
4
fun.go
4
fun.go
|
@ -156,10 +156,14 @@ func herdofemus(noise string) []Emu {
|
||||||
|
|
||||||
var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?']+)\*\*($|\W)`)
|
var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?']+)\*\*($|\W)`)
|
||||||
var re_italicer = 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 {
|
func markitzero(s string) string {
|
||||||
s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3")
|
s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3")
|
||||||
s = re_italicer.ReplaceAllString(s, "$1<i>$2</i>$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
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue