Skip to content

Commit 36b9252

Browse files
committed
just escape @ in output text with autolink! ez!
1 parent d2d0cbb commit 36b9252

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/cm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ impl<'a, 'o, 'c> CommonMarkFormatter<'a, 'o, 'c> {
232232
|| c == '\\'
233233
|| c == '`'
234234
|| c == '!'
235+
|| (self.options.extension.autolink && c == '@')
235236
|| (c == '&' && isalpha(nextb))
236237
|| (c == '!' && nextb == 0x5b)
237238
|| (self.begin_content

src/tests/commonmark.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,16 @@ Let's include some \*important\* \_ones\_ too.
132132
options.render.experimental_minimize_commonmark = true;
133133
commonmark(input, input, Some(&options));
134134
}
135+
136+
#[test]
137+
fn dont_create_autolinks() {
138+
let input = "[email protected]_";
139+
140+
let mut options = Options::default();
141+
options.extension.autolink = true;
142+
143+
let expected = "a\\_b\\@c.d\\_\n";
144+
commonmark(input, expected, Some(&options));
145+
146+
commonmark(expected, expected, Some(&options));
147+
}

vendor/cmark-gfm

0 commit comments

Comments
 (0)