diff --git a/lychee-lib/src/extract/markdown.rs b/lychee-lib/src/extract/markdown.rs index 782f36169e..6a590e52b4 100644 --- a/lychee-lib/src/extract/markdown.rs +++ b/lychee-lib/src/extract/markdown.rs @@ -65,6 +65,10 @@ pub(crate) fn extract_markdown(input: &str, include_verbatim: bool) -> Vec { inside_link_block = true; + //Ignore gitlab toc notation: https://docs.gitlab.com/user/markdown/#table-of-contents + if ["_TOC_".to_string(), "TOC".to_string()].contains(&dest_url.to_string()) { + return None; + } Some(vec![RawUri { text: dest_url.to_string(), element: Some("a".to_string()), @@ -421,4 +425,11 @@ $$ let uris = extract_markdown(markdown, true); assert_eq!(uris, expected); } + + #[test] + fn test_ignore_gitlab_toc() { + let markdown = r"[[_TOC_]][TOC]"; + let uris = extract_markdown(markdown, true); + assert!(uris.is_empty()); + } }