diff --git a/src/lib.rs b/src/lib.rs index d762b95..4857efc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,11 @@ impl<'a> Parse for SyntectParser<'a> { let file = String::from_utf8_lossy(src).to_string(); let result = CODE_BLOCK_RE .replace_all(file.as_str(), |captures: &Captures| { - let syntax = self.syntax_set.find_syntax_by_token(&captures[1]).unwrap(); + let syntax = self + .syntax_set + .find_syntax_by_token(&captures[1]) + .unwrap_or(self.syntax_set.find_syntax_plain_text()); + highlighted_html_for_string( &captures[2], &self.syntax_set,