Skip to content

Commit

Permalink
Fix redundant newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
hypergonial committed Sep 26, 2023
1 parent 1277850 commit 1f3bef5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 0.1.1

- Fix redundant newlines being inserted to generated `SUMMARY.md`

## 0.1.0

- Initial release
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mdbook-autosummary"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["hypergonial"]
rust-version = "1.70"
Expand Down
8 changes: 4 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ impl Display for DocFolder {
.iter()
.filter(|c| matches!(c, DocStructure::File(_)))
{
writeln!(f, "{}", child)?;
write!(f, "{}", child)?;
}

for child in self
.children
.iter()
.filter(|c| matches!(c, DocStructure::Folder(_)))
{
writeln!(f, "{}", child)?;
write!(f, "{}", child)?;
}

Ok(())
Expand Down Expand Up @@ -274,10 +274,10 @@ impl Display for DocFile {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// If this file is in the src root
if self.depth == 0 || self.depth == 1 {
return write!(f, "[{}]({})", self.title, self.path.display());
return writeln!(f, "[{}]({})", self.title, self.path.display());
}

write!(
writeln!(
f,
"{}- [{}]({})",
" ".repeat(((self.depth - 1) as usize) * 2),
Expand Down

0 comments on commit 1f3bef5

Please sign in to comment.