Skip to content

Commit ccfd6fe

Browse files
committed
Fix testing
1 parent 262ebca commit ccfd6fe

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function toMarkdown(tree, options = {}) {
4040

4141
/** @type {Handle} */
4242
context.handle = zwitch('type', {
43+
// @ts-expect-error: TODO: fix the typing here.
4344
invalid,
4445
unknown,
4546
handlers: context.handlers

lib/unsafe.js

Lines changed: 1 addition & 1 deletion
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: '+', before: "\\ \\t\\r\\n"},
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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,9 +3026,15 @@ test('escape', (t) => {
30263026
)
30273027

30283028
t.equal(
3029-
to({type: 'paragraph', children: [{type: 'text', value: 'a+b'}]}),
3030-
'a+b\n',
3031-
'should not escape what can’t be a list (plus)'
3029+
to({type: 'paragraph', children: [{type: 'text', value: 'a\\+b'}]}),
3030+
'a\\\\+b\n',
3031+
'should escape what would otherwise be a character escape'
3032+
)
3033+
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'
30323038
)
30333039

30343040
t.equal(

0 commit comments

Comments
 (0)