nechotron/markdown.go

15 lines
325 B
Go

package nechotron
import (
"regexp"
"strings"
)
var chars = []string{"_", "*", "\\[", "\\]", "\\(", "\\)", "~", "`", ">", "#", "+", "-", "=", "|", "{", "}", ".", "!"}
var r = strings.Join(chars, "")
var reg = regexp.MustCompile("[" + r + "]+")
func EscapeMd2(s string) string {
return reg.ReplaceAllString(s, "\\$0")
}