diff --git a/markup/lexer_test.go b/markup/lexer_test.go index 3298a36..b19bec2 100644 --- a/markup/lexer_test.go +++ b/markup/lexer_test.go @@ -41,7 +41,7 @@ func TestLex(t *testing.T) { `}, {6, "

text

"}, {7, "

more text

"}, - {8, `

some link

`}, + {8, `

some link

`}, {9, ``}, diff --git a/markup/paragraph.go b/markup/paragraph.go index 1eb1f9b..8f90085 100644 --- a/markup/paragraph.go +++ b/markup/paragraph.go @@ -17,6 +17,7 @@ const ( spanSuper spanSub spanMark + spanStrike spanLink ) @@ -78,7 +79,7 @@ func getTextNode(input *bytes.Buffer) string { escaping = false } else if b == '\\' { escaping = true - } else if strings.IndexByte("/*`^,![", b) >= 0 { + } else if strings.IndexByte("/*`^,![~", b) >= 0 { input.UnreadByte() break } else { @@ -127,6 +128,9 @@ func ParagraphToHtml(hyphaName, input string) string { case startsWith("!!"): ret.WriteString(tagFromState(spanMark, tagState, "mark", "!!")) p.Next(2) + case startsWith("~~"): + ret.WriteString(tagFromState(spanMark, tagState, "s", "~~")) + p.Next(2) case startsWith("[["): ret.WriteString(getLinkNode(p, hyphaName)) default: @@ -149,6 +153,8 @@ func ParagraphToHtml(hyphaName, input string) string { ret.WriteString(tagFromState(spanSub, tagState, "sub", ",,")) case spanMark: ret.WriteString(tagFromState(spanMark, tagState, "mark", "!!")) + case spanStrike: + ret.WriteString(tagFromState(spanMark, tagState, "s", "~~")) case spanLink: ret.WriteString(tagFromState(spanLink, tagState, "a", "[[")) } diff --git a/markup/paragraph_test.go b/markup/paragraph_test.go index 6fd1d91..71bd5fc 100644 --- a/markup/paragraph_test.go +++ b/markup/paragraph_test.go @@ -32,6 +32,7 @@ func TestParagraphToHtml(t *testing.T) { {"Embedded //italic//", "Embedded italic"}, {"double //italian// //text//", "double italian text"}, {"it has `mono`", "it has mono"}, + {"it has ~~strike~~", "it has strike"}, {"this is a left **bold", "this is a left bold"}, {"this line has a ,comma, two of them", "this line has a ,comma, two of them"}, {"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."},