Skip to content

Commit 8391420

Browse files
authored
Merge pull request #635 from miketheman/miketheman/strikethrough-inconsistency
test: add complex tilde behavior
2 parents 6145d8e + e9179cc commit 8391420

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/parser/inlines.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,16 @@ impl<'a, 'r, 'o, 'd, 'c, 'p> Subject<'a, 'r, 'o, 'd, 'c, 'p> {
938938
self.pos - 1,
939939
);
940940

941-
if (can_open || can_close) && (!(c == b'\'' || c == b'"') || self.options.parse.smart) {
941+
let is_valid_strikethrough_delim = if c == b'~' && self.options.extension.strikethrough {
942+
numdelims <= 2
943+
} else {
944+
true
945+
};
946+
947+
if (can_open || can_close)
948+
&& (!(c == b'\'' || c == b'"') || self.options.parse.smart)
949+
&& is_valid_strikethrough_delim
950+
{
942951
self.push_delimiter(c, can_open, can_close, inl);
943952
}
944953

src/tests/strikethrough.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ fn strikethrough() {
77
concat!(
88
"This is ~strikethrough~.\n",
99
"\n",
10-
"As is ~~this, okay~~?\n"
10+
"As is ~~this, okay~~?\n",
11+
"\n",
12+
"This ~text~~~~ is ~~~~curious~.\n",
1113
),
1214
concat!(
1315
"<p>This is <del>strikethrough</del>.</p>\n",
14-
"<p>As is <del>this, okay</del>?</p>\n"
16+
"<p>As is <del>this, okay</del>?</p>\n",
17+
"<p>This <del>text~~~~ is ~~~~curious</del>.</p>\n",
1518
),
1619
);
1720
}

0 commit comments

Comments
 (0)