diff --git a/tree-sitter-markdown/src/scanner.c b/tree-sitter-markdown/src/scanner.c index e21055b..2692998 100644 --- a/tree-sitter-markdown/src/scanner.c +++ b/tree-sitter-markdown/src/scanner.c @@ -415,7 +415,7 @@ static bool parse_fenced_code_block(Scanner *s, const char delimiter, if ((delimiter == '`' ? valid_symbols[FENCED_CODE_BLOCK_END_BACKTICK] : valid_symbols[FENCED_CODE_BLOCK_END_TILDE]) && s->indentation < 4 && level >= s->fenced_code_block_delimiter_length && - (lexer->lookahead == '\n' || lexer->lookahead == '\r')) { + iswspace(lexer->lookahead)) { s->fenced_code_block_delimiter_length = 0; lexer->result_symbol = delimiter == '`' ? FENCED_CODE_BLOCK_END_BACKTICK : FENCED_CODE_BLOCK_END_TILDE; diff --git a/tree-sitter-markdown/test/corpus/spec.txt b/tree-sitter-markdown/test/corpus/spec.txt index 9a654ee..a087a0e 100644 --- a/tree-sitter-markdown/test/corpus/spec.txt +++ b/tree-sitter-markdown/test/corpus/spec.txt @@ -1988,8 +1988,10 @@ Example 117 - https://github.github.com/gfm/#example-117 (fenced_code_block (fenced_code_block_delimiter) (block_continuation) - (code_fence_content - (block_continuation)) + (ERROR + (fenced_code_block_delimiter)) + (code_fence_content)) + (fenced_code_block (fenced_code_block_delimiter)))) ================================================================================