Handle code block with indented escapce character
This commit is contained in:
parent
a70213b009
commit
1b4778d0bc
@ -505,9 +505,16 @@ fn hide_sharp_behind_comment<'a>(s: &'a str) -> Cow<'a, str> {
|
||||
}
|
||||
}
|
||||
|
||||
fn trim_custom_comment_prefix(s: String) -> String {
|
||||
fn trim_custom_comment_prefix(s: &str) -> String {
|
||||
s.lines()
|
||||
.map(|line| line.trim_left_matches(RUSTFMT_CUSTOM_COMMENT_PREFIX))
|
||||
.map(|line| {
|
||||
let left_trimmed = line.trim_left();
|
||||
if left_trimmed.starts_with(RUSTFMT_CUSTOM_COMMENT_PREFIX) {
|
||||
left_trimmed.trim_left_matches(RUSTFMT_CUSTOM_COMMENT_PREFIX)
|
||||
} else {
|
||||
line
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user