Skip to content

Commit

Permalink
Reset backticks_count on italic code block end
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Mar 3, 2024
1 parent a2a22c1 commit b1834db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions mds/mds.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export function parser_write(p, chunk) {
if ('`' === char) {
if (pending_with_char.length === p.backticks_count) {
p.pending = ""
p.backticks_count = 0
parser_add_text(p)
parser_end_token(p)
} else {
Expand Down
14 changes: 14 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,20 @@ for (let l = 1; l <= 2; l += 1) {
}]
)

test_single_write(c + "Code Inline x2" + c,
c+"a"+c+" "+c+"b"+c,
[{
type : mds.Token.Paragraph,
children: [{
type : mds.Token.Code_Inline,
children: ["a"]
}, " ", {
type : mds.Token.Code_Inline,
children: ["b"]
}],
}]
)

if (l > 1) {
const m = '`'.repeat(l - 1)

Expand Down

0 comments on commit b1834db

Please sign in to comment.