Skip to content

Commit 6856d6d

Browse files
committed
Fix titles being eaten
1 parent b7d4f2b commit 6856d6d

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
## 0.1.8
6+
7+
- Fix chapter titles being consumed by the parser.
8+
59
## 0.1.7
610

711
- Handle chapter titles with comments.

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mdbook-autosummary"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
edition = "2021"
55
authors = ["hypergonial"]
66
rust-version = "1.70"

src/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ impl DocFile {
260260
// Try to find an h1 heading
261261
for line in lines {
262262
if line.starts_with("# ") {
263-
let (mut title, _) = line
263+
let (_, mut title) = line
264264
.split_once("# ")
265265
.expect("Chapter title heading not found.");
266266
if let Some((title_without_comment, _)) = title.split_once("<!--") {
267-
title = title_without_comment;
267+
title = title_without_comment.trim();
268268
}
269269
return Some(Self::new(title, path.to_path_buf(), depth));
270270
}

0 commit comments

Comments
 (0)