Skip to content

Commit 2d35e7c

Browse files
committed
Fix superfluous escape in digits
1 parent bbbf689 commit 2d35e7c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/unsafe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = [
5757
// underlines.
5858
{atBreak: true, character: '-'},
5959
// A dot could start a list item.
60-
{atBreak: true, before: '\\d+', character: '.'},
60+
{atBreak: true, before: '\\d+', character: '.', after: '(?:[ \t\r\n]|$)'},
6161
// Slash, colon, and semicolon are not used in markdown for constructs.
6262
// A less than can start html (flow or text) or an autolink.
6363
// HTML could start with an exclamation mark (declaration, cdata, comment),

test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,12 @@ test('escape', function (t) {
25462546
'should escape what would otherwise be a list item (paren)'
25472547
)
25482548

2549+
t.equal(
2550+
to({type: 'paragraph', children: [{type: 'text', value: '1.2.3. asd'}]}),
2551+
'1.2.3. asd\n',
2552+
'should not escape what can’t be a list (dot)'
2553+
)
2554+
25492555
t.end()
25502556
})
25512557

0 commit comments

Comments
 (0)