diff --git a/TestFiles/2024-03-30.md b/TestFiles/2024-03-30.md index e69de29b..e021f56c 100644 --- a/TestFiles/2024-03-30.md +++ b/TestFiles/2024-03-30.md @@ -0,0 +1 @@ +[[2024-04-17]] diff --git a/TestFiles/2024-04-17.md b/TestFiles/2024-04-17.md new file mode 100644 index 00000000..2d0deaf3 --- /dev/null +++ b/TestFiles/2024-04-17.md @@ -0,0 +1,17 @@ + + +![](./img/2024-04-17-15-14-12.md) + +![](img/2024-04-17-15-14-12.png) + +![](./img/2024-04-17-15-14-12.png) + +[First Heading]() + +[First Heading]() +[First Heading]() + +[Heading 1]() + +[Heading 1](Test) + diff --git a/TestFiles/test.png b/TestFiles/test.png new file mode 100644 index 00000000..cc6af19e Binary files /dev/null and b/TestFiles/test.png differ diff --git a/src/vault/mod.rs b/src/vault/mod.rs index fae87859..eef8c774 100644 --- a/src/vault/mod.rs +++ b/src/vault/mod.rs @@ -269,7 +269,17 @@ impl Vault { let mut path = self.root_dir().clone(); path.push(&reference.data().reference_text); - Some(Referenceable::UnresovledFile(path, &data.reference_text)) +Some(Referenceable::UnresovledFile(path, &data.reference_text)) + + // match data.reference_text.chars().collect_vec().as_slice() { + + // [..,'.','m','d'] => + // ['.', '/', rest @ ..] + // | ['/', rest @ ..] + // | rest if !rest.contains(&'.') => Some(Referenceable::UnresovledFile(path, &data.reference_text)), + // _ => None + // } + } Reference::WikiHeadingLink(_data, end_path, heading) | Reference::MDHeadingLink(_data, end_path, heading) => { @@ -724,12 +734,16 @@ impl Reference { }); static MD_LINK_RE: Lazy = Lazy::new(|| { - Regex::new(r"\[(?[^\[\]\.]*)\]\((\.?\/)?[^\[\]\|\.\#<>]+)(\.[^\# <>]+)?(\#(?[^\[\]\.\|<>]+))?>?\)") + Regex::new(r"\[(?[^\[\]\.]*)\]\((\.?\/)?[^\[\]\|\.\#<>]+)(?\.[^\# <>]+)?(\#(?[^\[\]\.\|<>]+))?>?\)") .expect("MD Link Not Constructing") }); // [display](relativePath) let md_links = MD_LINK_RE .captures_iter(text) + .filter(|captures| match captures.name("ending").map(|ending| ending.as_str()) { + Some(".md") | None => true, + _ => false + }) .flat_map(RegexTuple::new) .flat_map(|regextuple| { generic_link_constructor::(text, regextuple)