Skip to content

Commit db3c46a

Browse files
Fix GFM tables interfering with other constructs
Closes GH-19. Co-authored-by: Christian Murphy <[email protected]>
1 parent ccf6775 commit db3c46a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/construct/gfm_table.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ pub fn head_row_break(tokenizer: &mut Tokenizer) -> State {
331331
match tokenizer.current {
332332
None => {
333333
tokenizer.tokenize_state.seen = false;
334+
tokenizer.tokenize_state.size = 0;
334335
State::Nok
335336
}
336337
Some(b'\n') => {
@@ -427,6 +428,7 @@ pub fn head_delimiter_start(tokenizer: &mut Tokenizer) -> State {
427428
tokenizer.interrupt = false;
428429

429430
if tokenizer.lazy || tokenizer.pierce {
431+
tokenizer.tokenize_state.size = 0;
430432
State::Nok
431433
} else {
432434
tokenizer.enter(Name::GfmTableDelimiterRow);

tests/fuzz.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,11 @@ fn fuzz() -> Result<(), String> {
6868
"6-b: container close after unclosed fenced code, with eol (list, GH-16)"
6969
);
7070

71+
assert_eq!(
72+
to_html_with_options("> x\n``", &Options::gfm()),
73+
Ok("<blockquote>\n<p>x</p>\n</blockquote>\n<p>``</p>".into()),
74+
"7: lazy container lines almost starting fenced code (GH-19)"
75+
);
76+
7177
Ok(())
7278
}

0 commit comments

Comments
 (0)