Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track underscore bottom separately mod 3, like asterisk #272

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
7 changes: 4 additions & 3 deletions lib/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ var processEmphasis = function(stack_bottom) {
var openers_bottom_index;
var odd_match = false;

for (var i = 0; i < 8; i++) {
for (var i = 0; i < 14; i++) {
openers_bottom[i] = stack_bottom;
}
// find first closer above stack_bottom:
Expand All @@ -407,10 +407,11 @@ var processEmphasis = function(stack_bottom) {
openers_bottom_index = 1;
break;
case C_UNDERSCORE:
openers_bottom_index = 2;
openers_bottom_index = 2 + (closer.can_open ? 3 : 0)
+ (closer.origdelims % 3);
break;
case C_ASTERISK:
openers_bottom_index = 3 + (closer.can_open ? 3 : 0)
openers_bottom_index = 8 + (closer.can_open ? 3 : 0)
+ (closer.origdelims % 3);
break;
}
Expand Down
29 changes: 29 additions & 0 deletions test/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,32 @@ Link reference definitions are blocks when checking list tightness.
</li>
</ul>
````````````````````````````````

An underscore that is not part of a delimiter should not prevent another
pair of underscores from forming part of their own.
```````````````````````````````` example
__!_!__

__!x!__

**!*!**

---

_*__*_*

_*xx*_*

_*__-_-

_*xx-_-
.
<p><strong>!_!</strong></p>
<p><strong>!x!</strong></p>
<p><strong>!*!</strong></p>
<hr />
<p><em><em>__</em></em>*</p>
<p><em><em>xx</em></em>*</p>
<p><em>*__-</em>-</p>
<p><em>*xx-</em>-</p>
````````````````````````````````
Loading