pub fn parse_inner(inner: &str, embed: bool) -> Option<WikiLink>Expand description
Parse a single wikilink body (the text between the brackets).
A \ right before the first | is the escape a GFM table cell needs
([[Note\|alias]]) and is dropped from the target or heading.
ยงExamples
use markdown_link::{WikiLink, parse_inner};
let link = parse_inner("Note#Intro|Read me", false).unwrap();
assert_eq!(
link,
WikiLink {
target: "Note".into(),
heading: Some("Intro".into()),
alias: Some("Read me".into()),
embed: false,
}
);
// The `\` that escapes the pipe in a table cell is dropped.
assert_eq!(parse_inner("Note\\|alias", false).unwrap().target, "Note");
// A link with no target is not a link.
assert!(parse_inner(" #only-heading", false).is_none());