Skip to main content

escape_code

Function escape_code 

Source
pub fn escape_code(input: &str) -> String
Expand description

Escape for use inside an inline code span (backticks).

Backticks terminate the span, so they are replaced. Angle brackets and ampersands are entity-encoded as defense-in-depth: a Markdown code span renders its content literally, but we never want raw <script>-style text to reach a consumer that might mis-handle it. Newlines are flattened.