Skip to main content

one_line

Function one_line 

Source
pub fn one_line(s: &str) -> String
Expand description

Strip every [label](url) markdown link in text down to just its label and return the cleaned-up text plus a HelpLink per link with its byte range computed against the CLEANED text. This is what the help-buffer constructor uses so the user reads ex:write instead of [ex:write](command:ex:write). The link’s URL still drives navigation – it’s stored on the returned HelpLink::target but the URL bytes don’t appear in the rendered output. Collapse a multi-line diagnostic message to a single line. LSP messages can contain newlines (e.g. rust-analyzer’s “expected Foo, found Bar\n – in fn::method”). The help-buffer’s row layout assumes one row per entry; squash to keep visual alignment.