-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue with nested Markdown lists
- Loading branch information
1 parent
994cd6e
commit f5a669d
Showing
7 changed files
with
168 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use harper_core::{Document, FullDictionary, LintGroup, LintGroupConfig, Linter}; | ||
|
||
/// Creates a unit test checking that the linting of a Markdown document (in `tests_sources`) | ||
/// produces the expected number of lints. | ||
macro_rules! create_test { | ||
($filename:ident.md, $correct_expected:expr) => { | ||
paste::paste! { | ||
#[test] | ||
fn [<lints_ $filename _correctly>](){ | ||
let source = include_str!( | ||
concat!( | ||
"./test_sources/", | ||
concat!(stringify!($filename), ".md") | ||
) | ||
); | ||
|
||
let document = Document::new_markdown(&source); | ||
|
||
let mut linter = LintGroup::new( | ||
LintGroupConfig::default(), | ||
FullDictionary::create_from_curated() | ||
); | ||
let lints = linter.lint(&document); | ||
|
||
dbg!(&lints); | ||
assert_eq!(lints.len(), $correct_expected); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
create_test!(whack_bullets.md, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This is a big heading, with a lot of words | ||
|
||
- New here's a list, this part doesn't have as many words | ||
- But this part does, it has so many words, more words than you could ever dream of | ||
Just look at all those words | ||
- So does this part, I might be overwhelmed with all these words | ||
- This is an test to make sure it isn't crashing |