Skip to content

Commit

Permalink
Remove escape of + when not followed by whitespace
Browse files Browse the repository at this point in the history
Closes GH-57.
  • Loading branch information
ocavue committed Dec 13, 2022
1 parent aa7a4c5 commit 4cb437c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/unsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '-'},
Expand Down
6 changes: 6 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 4cb437c

Please sign in to comment.