n_backticks_to_wrap_codespan

Function n_backticks_to_wrap_codespan 

Source
pub fn n_backticks_to_wrap_codespan(character: char, text: &str) -> usize
Expand description

Return the minimum possible of characters not found in a row.

For example, given the string "c cc cccc" and the character "c", returns the minimum number of characters in a row that are not found, so 3 in this case.

This function is useful in to compute the number of backticks that must wrap markdown code spans. Given the code span "code that contains 3 \`\`\` and 2 \`\` backticks" and the character "`", this function returns 1.

Args: character (str): Character to search. text (str): Text inside which find the character repeated in a row.

Returns: int: Minimum number possible of characters not found in a row.