package main
import "regexp"
var bold_italic *regexp.Regexp
var bold *regexp.Regexp
var italic *regexp.Regexp
func init() {
plugins["markdown"] = Plugin{"markdown","Markdown","Azareal","http://github.com/Azareal","",false,"",init_markdown,nil,deactivate_markdown}
}
func init_markdown() {
add_hook("parse_assign", markdown_parse)
bold_italic = regexp.MustCompile(`\*\*\*(.*)\*\*\*`)
bold = regexp.MustCompile(`\*\*(.*)\*\*`)
italic = regexp.MustCompile(`\*(.*)\*`)
}
func deactivate_markdown() {
remove_hook("parse_assign")
}
func markdown_parse(data interface{}) interface{} {
msg := data.(string)
msg = bold_italic.ReplaceAllString(msg,"$1")
msg = bold.ReplaceAllString(msg,"$1")
msg = italic.ReplaceAllString(msg,"$1")
return msg
}