upgrade hyperlink: can now CONTAIN other syntaxes | can be interlaced with other syntaxes (at beginning, or contains [ without a \033 before)
This commit is contained in:
parent
943e61119c
commit
3a25db9d18
|
@ -10,12 +10,12 @@ type export string
|
|||
var Export = export("hyperlink")
|
||||
|
||||
func (syn export) Regex() *regexp.Regexp {
|
||||
return regexp.MustCompile(`(?m)([^\033])\[([^(?:\]()]+)\]\(([^\)]+)\)`)
|
||||
return regexp.MustCompile(`(?m)(^|[^\x1b])\[([^(?:\]()]+)\]\(([^\)]+)\)`)
|
||||
}
|
||||
|
||||
func (syn export) Transform(args ...string) (string, error) {
|
||||
// no arg, empty -> ignore
|
||||
if len(args) < 2 || len(args[0]) < 1 {
|
||||
if len(args) < 2 || len(args[1]) < 1 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue