Skip to main content

strip_code

Function strip_code 

Source
pub fn strip_code(text: &str) -> String
Expand description

Blank out fenced and inline code so links and tags inside it are not harvested. strip_code_with under CodeRules::CommonMark.

ยงExamples

use markdown_link::strip_code;

let text = "a `[[x]]` b\n```\n[[y]]\n```\n[[z]]";
let blanked = strip_code(text);
assert!(!blanked.contains("[[x]]"));
assert!(!blanked.contains("[[y]]"));
assert!(blanked.contains("[[z]]"));
assert_eq!(blanked.chars().count(), text.chars().count());