Skip to content

Commit 0dad192

Browse files
committed
add mark delimiter to plain text splitter
fixes #668
1 parent 07b4280 commit 0dad192

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.changeset/pretty-humans-hunt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'markdown-to-jsx': patch
3+
---
4+
5+
Fix consecutive marked text.

index.compiler.spec.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,21 @@ describe('inline textual elements', () => {
357357
`)
358358
})
359359

360+
it('should handle consecutive marked text', () => {
361+
render(compiler('==Hello== ==World=='))
362+
363+
expect(root.innerHTML).toMatchInlineSnapshot(`
364+
<span>
365+
<mark>
366+
Hello
367+
</mark>
368+
<mark>
369+
World
370+
</mark>
371+
</span>
372+
`)
373+
})
374+
360375
it('should handle marked text containing other syntax with an equal sign', () => {
361376
render(compiler('==Foo `==bar` baz.=='))
362377

index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ const TEXT_UNESCAPE_R = /\\([^0-9A-Za-z\s])/g
326326
* Always take the first character, then eagerly take text until a double space
327327
* (potential line break) or some markdown-like punctuation is reached.
328328
*/
329-
const TEXT_PLAIN_R = /^([\s\S](?:(?! |[0-9]\.)[^*_~\-\n<`\\\[!])*)/
329+
const TEXT_PLAIN_R = /^([\s\S](?:(?! |[0-9]\.)[^=*_~\-\n<`\\\[!])*)/
330330

331331
const TRIM_STARTING_NEWLINES = /^\n+/
332332

0 commit comments

Comments
 (0)