Skip to content

Commit

Permalink
Skip two symbols if coming from emph3, which will handle the reverse …
Browse files Browse the repository at this point in the history
…bold and italics ordering case
  • Loading branch information
cddude229 committed May 2, 2024
1 parent e161098 commit 9e52993
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions inline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ func TestEmphasisMix(t *testing.T) {
"*italics **and bold***\n",
"<p><em>italics <strong>and bold</strong></em></p>\n",

"***bold** and italics*\n",
"<p><em><strong>bold</strong> and italics</em></p>\n",

"*start **bold** and italics*\n",
"<p><em>start <strong>bold</strong> and italics</em></p>\n",

"*__triple emphasis__*\n",
"<p><em><strong>triple emphasis</strong></em></p>\n",

Expand Down
4 changes: 2 additions & 2 deletions parser/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,9 +1185,9 @@ func helperFindEmphChar(data []byte, c byte) int {
func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
i := 0

// skip one symbol if coming from emph3
// skip two symbols if coming from emph3, as it detected a double emphasis case
if len(data) > 1 && data[0] == c && data[1] == c {
i = 1
i += 2
}

for i < len(data) {
Expand Down

0 comments on commit 9e52993

Please sign in to comment.