From 3a25db9d18f56800a7e9c3543114e3aed3ec984b Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 31 Jan 2019 09:28:57 +0100 Subject: [PATCH] upgrade hyperlink: can now CONTAIN other syntaxes | can be interlaced with other syntaxes (at beginning, or contains [ without a \033 before) --- internal/syntax/hyperlink/hyperlink.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/syntax/hyperlink/hyperlink.go b/internal/syntax/hyperlink/hyperlink.go index d8815ce..c775351 100644 --- a/internal/syntax/hyperlink/hyperlink.go +++ b/internal/syntax/hyperlink/hyperlink.go @@ -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 }