Commit a725579
authored
fix(remend): don't complete emphasis/strikethrough markers inside complete inline code spans (#426)
* fix(remend): don't complete bold/italic/strikethrough inside complete inline code spans
Bold, italic, and strikethrough handlers were using isWithinCodeBlock()
which only detects triple-backtick fenced code blocks. Markers inside
single-backtick inline code spans (e.g. `**bold`) were incorrectly
completed, leaking outside the code span.
Fix:
- Add isWithinCompleteInlineCode() to code-block-utils.ts that returns
true only when a position is inside a *complete* (both delimiters
present) inline code span. This preserves the existing streaming
behavior where emphasis inside an *incomplete* inline code span
(still being streamed) continues to be closed correctly.
- Apply the check in handleIncompleteBold, handleIncompleteBoldItalic,
handleIncompleteDoubleUnderscoreItalic, handleIncompleteSingleAsterisk-
Italic, and handleIncompleteStrikethrough.
Fixes #424
* fix(remend): add isWithinCompleteInlineCode guard to handleIncompleteSingleUnderscoreItalic
* chore: add changeset for inline code emphasis fix
---------
Co-authored-by: Dmitrii Troitskii <jsleitor@gmail.com>1 parent 7b40437 commit a725579
File tree
6 files changed
+118
-8
lines changed- .changeset
- packages/remend
- __tests__
- src
6 files changed
+118
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | | - | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
340 | 343 | | |
341 | 344 | | |
342 | 345 | | |
343 | | - | |
344 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
345 | 351 | | |
346 | 352 | | |
347 | 353 | | |
| |||
404 | 410 | | |
405 | 411 | | |
406 | 412 | | |
407 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
408 | 419 | | |
409 | 420 | | |
410 | 421 | | |
| |||
417 | 428 | | |
418 | 429 | | |
419 | 430 | | |
420 | | - | |
421 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
422 | 436 | | |
423 | 437 | | |
424 | 438 | | |
| |||
506 | 520 | | |
507 | 521 | | |
508 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
509 | 531 | | |
510 | 532 | | |
511 | 533 | | |
| |||
655 | 677 | | |
656 | 678 | | |
657 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
658 | 684 | | |
659 | 685 | | |
660 | 686 | | |
| |||
688 | 714 | | |
689 | 715 | | |
690 | 716 | | |
691 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
692 | 721 | | |
693 | 722 | | |
694 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
24 | 37 | | |
25 | 38 | | |
26 | 39 | | |
| |||
31 | 44 | | |
32 | 45 | | |
33 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
34 | 55 | | |
35 | 56 | | |
36 | 57 | | |
| |||
0 commit comments