diff --git a/lychee-lib/src/extract/mod.rs b/lychee-lib/src/extract/mod.rs index b051cf6..1c41666 100644 --- a/lychee-lib/src/extract/mod.rs +++ b/lychee-lib/src/extract/mod.rs @@ -1,5 +1,3 @@ -use std::collections::HashSet; - use crate::types::{uri::raw::RawUri, FileType, InputContent}; mod html5ever; @@ -8,26 +6,16 @@ mod markdown; mod plaintext; use markdown::extract_markdown; -use once_cell::sync::Lazy; use plaintext::extract_plaintext; -/// HTML elements that are deemed verbatim (i.e. preformatted). +/// Check if the given element is in the list of preformatted ("verbatim") tags. +/// /// These will be excluded from link checking by default. -static VERBATIM_ELEMENTS: Lazy> = Lazy::new(|| { - HashSet::from_iter([ - "pre".into(), - "code".into(), - "textarea".into(), - "samp".into(), - "xmp".into(), - "plaintext".into(), - "listing".into(), - ]) -}); - -/// Check if the given element is in the list of preformatted tags pub(crate) fn is_verbatim_elem(name: &str) -> bool { - VERBATIM_ELEMENTS.contains(name) + matches!( + name, + "pre" | "code" | "textarea" | "samp" | "xmp" | "plaintext" | "listing" + ) } /// A handler for extracting links from various input formats like Markdown and