Skip to content

Commit

Permalink
Fix titles being eaten
Browse files Browse the repository at this point in the history
  • Loading branch information
hypergonial committed Jun 10, 2024
1 parent b7d4f2b commit 6856d6d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 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.8

- Fix chapter titles being consumed by the parser.

## 0.1.7

- Handle chapter titles with comments.
Expand Down
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.7"
version = "0.1.8"
edition = "2021"
authors = ["hypergonial"]
rust-version = "1.70"
Expand Down
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ impl DocFile {
// Try to find an h1 heading
for line in lines {
if line.starts_with("# ") {
let (mut title, _) = line
let (_, mut title) = line
.split_once("# ")
.expect("Chapter title heading not found.");
if let Some((title_without_comment, _)) = title.split_once("<!--") {
title = title_without_comment;
title = title_without_comment.trim();
}
return Some(Self::new(title, path.to_path_buf(), depth));
}
Expand Down

0 comments on commit 6856d6d

Please sign in to comment.