Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions index.compiler.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4824,3 +4824,26 @@ it('#597 handles script tag with empty content', () => {
</script>
`)
})

it('#473 handles content with multiple empty spaces without crashing', () => {
render(
compiler(
'Test \r\n \r\n Test'
)
)

expect(root.innerHTML).toMatchInlineSnapshot(`
<div>
<p>
Test
</p>
<pre>
<code>
</code>
</pre>
<p>
Test
</p>
</div>
`)
})
2 changes: 1 addition & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const BREAK_LINE_R = /^ {2,}\n/
const BREAK_THEMATIC_R = /^(?:( *[-*_])){3,} *(?:\n *)+\n/
const CODE_BLOCK_FENCED_R =
/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/
const CODE_BLOCK_R = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/
const CODE_BLOCK_R = /^(?: {4}[^\n]+\n*)+(?:\n *)*\n?/
const CODE_INLINE_R = /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/
const CONSECUTIVE_NEWLINE_R = /^(?:\n *)*\n/
const CR_NEWLINE_R = /\r\n?/g
Expand Down
Loading