Skip to main content

parse_inner_self

Function parse_inner_self 

Source
pub fn parse_inner_self(inner: &str, embed: bool) -> Option<WikiLink>
Expand description

parse_inner, except that a link with no target and a # fragment, such as #Heading or #^block, is a link to the note it is written in: its target is empty. This is how Obsidian reads [[#Heading]].

ยงExamples

use markdown_link::parse_inner_self;

let link = parse_inner_self("#Intro", false).unwrap();
assert_eq!((link.target.as_str(), link.heading.as_deref()), ("", Some("Intro")));
assert!(parse_inner_self("|alias only", false).is_none());
assert_eq!(parse_inner_self("Note", false).unwrap().target, "Note");