Skip to main content

format_reference

Function format_reference 

Source
pub fn format_reference(reference: &str) -> String
Expand description

Quotes a reference when it would not survive parsing as a bare word.

links-notation opens a quoted reference with a run of N equal quote characters, closes it with the next run of exactly N, and reads 2N quotes inside as N literal ones. The opening run is counted greedily, so the chosen quote must differ from the first character; N is one more than the longest run of that quote inside, and odd, because an even delimiter run may be read as an empty reference.