diff --git a/lib/unsafe.js b/lib/unsafe.js index 251fe9b..4c96ae9 100644 --- a/lib/unsafe.js +++ b/lib/unsafe.js @@ -88,7 +88,7 @@ export const unsafe = [ {atBreak: true, character: '*'}, {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, // A plus sign could start a list item. - {atBreak: true, character: '+'}, + {atBreak: true, character: '+', after: '(?:[ \t\r\n])'}, // A dash can start thematic breaks, list items, and setext heading // underlines. {atBreak: true, character: '-'}, diff --git a/test/index.js b/test/index.js index 9f760b6..fd56080 100644 --- a/test/index.js +++ b/test/index.js @@ -3031,6 +3031,12 @@ test('escape', (t) => { 'should escape what would otherwise be a character escape' ) + t.equal( + to({type: 'paragraph', children: [{type: 'text', value: '+a'}]}), + '+a\n', + 'should not escape a `+` if it is not followed by a whitespace' + ) + t.equal( to({ type: 'paragraph',