From 5856e91f84673483dec5e83c5cbaa8c2da345cd7 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 4 Dec 2018 18:26:18 +0100 Subject: [PATCH] Allow beginning of line as begin of tag as well --- postrender.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postrender.go b/postrender.go index d2af941..c1d970f 100644 --- a/postrender.go +++ b/postrender.go @@ -21,7 +21,7 @@ var ( endBlockReg = regexp.MustCompile("\n") youtubeReg = regexp.MustCompile("(https?://www.youtube.com/embed/[a-zA-Z0-9\\-_]+)(\\?[^\t\n\f\r \"']+)?") titleElementReg = regexp.MustCompile("") - hashtagReg = regexp.MustCompile(` #([\p{L}\p{M}\d]+)`) + hashtagReg = regexp.MustCompile(`(?m)(^| )#([\p{L}\p{M}\d]+)`) markeddownReg = regexp.MustCompile("

(.+)

") ) @@ -36,7 +36,7 @@ func (p *Post) formatContent(c *Collection, isOwner bool) { // URL, so we rely on p.Tags as the final word on whether or not to link // a tag. for _, t := range p.Tags { - if string(b) == " #"+t { + if strings.TrimSpace(string(b)) == "#"+t { return bytes.Replace(b, []byte("#"+t), []byte("#"+t+""), -1) } }