Skip to content

Commit 5a35144

Browse files
authored
Merge pull request #2328 from ehuss/clarify-src-path
Clarify Chapter path and source_path.
2 parents c602a2f + 5f5f9d6 commit 5a35144

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/book/book.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,20 @@ pub struct Chapter {
160160
/// Nested items.
161161
pub sub_items: Vec<BookItem>,
162162
/// The chapter's location, relative to the `SUMMARY.md` file.
163+
///
164+
/// **Note**: After the index preprocessor runs, any README files will be
165+
/// modified to be `index.md`. If you need access to the actual filename
166+
/// on disk, use [`Chapter::source_path`] instead.
167+
///
168+
/// This is `None` for a draft chapter.
163169
pub path: Option<PathBuf>,
164170
/// The chapter's source file, relative to the `SUMMARY.md` file.
171+
///
172+
/// **Note**: Beware that README files will internally be treated as
173+
/// `index.md` via the [`Chapter::path`] field. The `source_path` field
174+
/// exists if you need access to the true file path.
175+
///
176+
/// This is `None` for a draft chapter.
165177
pub source_path: Option<PathBuf>,
166178
/// An ordered list of the names of each chapter above this one in the hierarchy.
167179
pub parent_names: Vec<String>,

0 commit comments

Comments
 (0)