pub fn strip_comments(document: &str) -> StringExpand description
Blanks out every comment in document, keeping every other byte where it
was.
Comments are replaced rather than removed so that a byte offset in the
result is the same byte offset in document: the line and column a parse
error reports are the line and column the writer sees in their file.
A # inside a delimited reference is content, so "# not a comment" is
still one reference.
ยงExamples
use links_notation::comments::strip_comments;
assert_eq!(strip_comments("a: b # why\n"), "a: b \n");
assert_eq!(strip_comments("\"# kept\"\n"), "\"# kept\"\n");
assert_eq!(strip_comments("issue#1047\n"), "issue#1047\n");