Inline codeblocks
This commit is contained in:
parent
c49ee937c9
commit
38f21125db
1 changed files with 6 additions and 4 deletions
|
|
@ -5,10 +5,11 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
boldRegex = regexp.MustCompile(`(?ms)\*\*(.*?)\*\*`)
|
||||
italicRegex = regexp.MustCompile(`(?ms)\*(.*?)\*`)
|
||||
underlineRegex = regexp.MustCompile(`(?ms)__(.*?)__`)
|
||||
strikeThroughRegex = regexp.MustCompile(`(?ms)~~(.*?)~~`)
|
||||
boldRegex = regexp.MustCompile(`(?ms)\*\*(.*?)\*\*`)
|
||||
italicRegex = regexp.MustCompile(`(?ms)\*(.*?)\*`)
|
||||
underlineRegex = regexp.MustCompile(`(?ms)__(.*?)__`)
|
||||
strikeThroughRegex = regexp.MustCompile(`(?ms)~~(.*?)~~`)
|
||||
inlineCodeBlockRegex = regexp.MustCompile("(?ms)`" + `([^` + "`" + `\n]+)` + "`")
|
||||
)
|
||||
|
||||
func Parse(input string) string {
|
||||
|
|
@ -16,5 +17,6 @@ func Parse(input string) string {
|
|||
input = italicRegex.ReplaceAllString(input, "[::i]$1[::-]")
|
||||
input = underlineRegex.ReplaceAllString(input, "[::u]$1[::-]")
|
||||
input = strikeThroughRegex.ReplaceAllString(input, "[::s]$1[::-]")
|
||||
input = inlineCodeBlockRegex.ReplaceAllString(input, "[::r]$1[::-]")
|
||||
return input
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue