Skip to content

Commit

Permalink
rewrite Output::write_line to fix indentation
Browse files Browse the repository at this point in the history
Simplify (maybe?) the code in Output::write_line -- or at least, change
it so that it now works.

Update lists to use the new code.
  • Loading branch information
yshavit authored Jun 9, 2024
1 parent 6ba0b8e commit 7404c55
Show file tree
Hide file tree
Showing 4 changed files with 332 additions and 227 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ serde_json = "1.0"
serde_yaml = "0.9"
regex = "1.10.4"
log = "0.4.21"
indoc = "2"
8 changes: 2 additions & 6 deletions src/fmt_md.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ where
N: Borrow<MdqNode>,
W: Write,
{
let mut iter = nodes.iter().peekable();
while let Some(node) = iter.next() {
for node in nodes {
write_one_md(out, node.borrow());
if iter.peek().is_some() {
write_one_md(out, &MdqNode::ThematicBreak)
}
}
}

Expand Down Expand Up @@ -70,8 +66,8 @@ where
prefix.push(if *checked { 'x' } else { ' ' });
prefix.push_str("] ");
}
out.write_str(&prefix);
out.with_block(Inlined(prefix.len()), |out| {
out.write_str(&prefix);
write_md(out, &item.item);
});
}
Expand Down
Loading

0 comments on commit 7404c55

Please sign in to comment.