mirror of
https://github.com/Automattic/harper.git
synced 2025-12-05 19:26:55 -06:00
feat(#104): process links as unlintable (not as a config option yet)
This commit is contained in:
@@ -202,9 +202,15 @@ impl Parser for Markdown {
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if matches!(tag, Tag::Link { .. }) {
|
||||
tokens.push(Token {
|
||||
span: Span::new_with_len(traversed_chars, text.chars().count()),
|
||||
kind: TokenKind::Unlintable,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
if !(matches!(tag, Tag::Paragraph)
|
||||
|| matches!(tag, Tag::Link { .. })
|
||||
|| matches!(tag, Tag::Heading { .. })
|
||||
|| matches!(tag, Tag::Item)
|
||||
|| matches!(tag, Tag::TableCell)
|
||||
@@ -353,4 +359,15 @@ mod tests {
|
||||
|
||||
assert!(matches!(token_kinds.as_slice(), &[TokenKind::Word(_)]))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn link_title_unlintable() {
|
||||
let source = r#"[elijah-potter/harper](https://github.com/elijah-potter/harper)"#;
|
||||
let tokens = Markdown.parse_str(source);
|
||||
let token_kinds = tokens.iter().map(|t| t.kind).collect::<Vec<_>>();
|
||||
|
||||
dbg!(&token_kinds);
|
||||
|
||||
assert!(matches!(token_kinds.as_slice(), &[TokenKind::Unlintable]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user