diff --git a/crates/quark/src/types/january.rs b/crates/quark/src/types/january.rs index 8c3ce44f..24aca7dc 100644 --- a/crates/quark/src/types/january.rs +++ b/crates/quark/src/types/january.rs @@ -202,12 +202,22 @@ impl Embed { let mut finder = LinkFinder::new(); finder.kinds(&[LinkKind::Url]); - let links: HashSet = finder + // Process all links, stripping anchors and + // only taking up to `max_embeds` of links. + let links: Vec = finder .links(&content) + .map(|x| { + x.as_str() + .chars() + .take_while(|&ch| ch != '#') + .collect::() + }) + .collect::>() + .into_iter() .take(max_embeds) - .map(|x| x.as_str().to_string()) .collect(); + // If no links, fail out. if links.is_empty() { return Err(Error::LabelMe); }