Skip to main content

code_span

Function code_span 

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

Wraps text in a code span that survives backticks inside it.

A thiserror message is full of them — it quotes the parameter name — and a single-backtick span would end at the first one, publishing the rest of the message as prose. The fix is the one Markdown specifies: a fence longer than the longest run of backticks inside, plus a space of padding when the content itself starts or ends with one.