Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: Markdown parser screwing with ellipsis

Elijah Potter3d3d7c3fbb7b
diff --git a/harper-core/src/linting/sentence_capitalization.rs b/harper-core/src/linting/sentence_capitalization.rs
index 602d0dd96..012b5807e 100644
--- a/harper-core/src/linting/sentence_capitalization.rs
+++ b/harper-core/src/linting/sentence_capitalization.rs
@@ -93,4 +93,13 @@ mod tests {
1
)
}
+
+ #[test]
+ fn unphased_ellipsis() {
+ assert_lint_count(
+ "the linter should not be affected by... that ellipsis.",
+ SentenceCapitalization,
+ 1
+ )
+ }
}
diff --git a/harper-core/src/parsers/markdown.rs b/harper-core/src/parsers/markdown.rs
index 155fdd10e..68fa89c95 100644
--- a/harper-core/src/parsers/markdown.rs
+++ b/harper-core/src/parsers/markdown.rs
@@ -124,8 +124,11 @@ impl Parser for Markdown {
let mut english_parser = PlainEnglish;
let source_str: String = source.iter().collect();
- let md_parser =
- pulldown_cmark::Parser::new_ext(&source_str, pulldown_cmark::Options::all());
+ let md_parser = pulldown_cmark::Parser::new_ext(
+ &source_str,
+ pulldown_cmark::Options::all()
+ .difference(pulldown_cmark::Options::ENABLE_SMART_PUNCTUATION)
+ );
let mut tokens = Vec::new();