From b69665f6a5e451190a1f73db2d6f20fd004ec77a Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 25 Oct 2019 00:27:00 -0400 Subject: [PATCH] try more aggresive bold matching and hope it doesn't break --- markitzero.go | 4 ++-- markitzero_test.go | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/markitzero.go b/markitzero.go index 8c2ad57..d954d20 100644 --- a/markitzero.go +++ b/markitzero.go @@ -24,8 +24,8 @@ import ( "humungus.tedunangst.com/r/webs/synlight" ) -var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?':_-]+)\*\*($|\W)`) -var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?':_-]+)\*($|\W)`) +var re_bolder = regexp.MustCompile(`(^|\W)\*\*((?s:.*?))\*\*($|\W)`) +var re_italicer = regexp.MustCompile(`(^|\W)\*((?s:.*?))\*($|\W)`) var re_bigcoder = regexp.MustCompile("```(.*)\n?((?s:.*?))\n?```\n?") var re_coder = regexp.MustCompile("`([^`]*)`") var re_quoter = regexp.MustCompile(`(?m:^> (.*)\n?)`) diff --git a/markitzero_test.go b/markitzero_test.go index 79f5131..7c7b7ca 100644 --- a/markitzero_test.go +++ b/markitzero_test.go @@ -17,6 +17,12 @@ func TestBasictest(t *testing.T) { doonezerotest(t, input, output) } +func TestMultibold(t *testing.T) { + input := `**in** out **in**` + output := `in out in` + doonezerotest(t, input, output) +} + func TestLinebreak1(t *testing.T) { input := "hello\n> a quote\na comment" output := "hello
a quote

a comment" @@ -72,7 +78,6 @@ func TestLinkinQuote(t *testing.T) { } func TestBoldLink(t *testing.T) { - t.SkipNow() input := `**b https://example.com/link b**` output := `b https://example.com/link b` doonezerotest(t, input, output)