Skip to content

Commit 4cb437c

Browse files
authoredDec 13, 2022
Remove escape of + when not followed by whitespace
Closes GH-57.
1 parent aa7a4c5 commit 4cb437c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎lib/unsafe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const unsafe = [
8888
{atBreak: true, character: '*'},
8989
{character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
9090
// A plus sign could start a list item.
91-
{atBreak: true, character: '+'},
91+
{atBreak: true, character: '+', after: '(?:[ \t\r\n])'},
9292
// A dash can start thematic breaks, list items, and setext heading
9393
// underlines.
9494
{atBreak: true, character: '-'},

‎test/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,12 @@ test('escape', (t) => {
30313031
'should escape what would otherwise be a character escape'
30323032
)
30333033

3034+
t.equal(
3035+
to({type: 'paragraph', children: [{type: 'text', value: '+a'}]}),
3036+
'+a\n',
3037+
'should not escape a `+` if it is not followed by a whitespace'
3038+
)
3039+
30343040
t.equal(
30353041
to({
30363042
type: 'paragraph',

0 commit comments

Comments
 (0)
Please sign in to comment.