Fix rust fenced code blocks with an indent
This fixes a bug in the Rust code block partitioning that was incorrectly removing the whitespace from the beginning of a code block.
This commit is contained in:
parent
3992bc18f5
commit
ddf02e0c0c
2 changed files with 11 additions and 4 deletions
|
|
@ -141,8 +141,15 @@ fn partition_rust_source(s: &str) -> (&str, &str) {
|
|||
let split_idx = match HEADER_RE.captures(s) {
|
||||
Some(caps) => {
|
||||
let attributes = &caps[1];
|
||||
if attributes.trim().is_empty() {
|
||||
// Don't include pure whitespace as an attribute. The
|
||||
// whitespace in the regex is intended to handle multiple
|
||||
// attributes *separated* by potential whitespace.
|
||||
0
|
||||
} else {
|
||||
attributes.len()
|
||||
}
|
||||
}
|
||||
None => 0,
|
||||
};
|
||||
s.split_at(split_idx)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue