Skip to content

Sub-chapters are not collapsed when having headings #2880

@jkr-ariel

Description

@jkr-ariel

Problem

The chapter folding option does not behave as expected when having headings in the page being currently opened. When clicking the collapse button on the sidebar, only the headings are collapsed, leaving any sub-chapter expanded.

Steps

  1. Create an empty directory: mkdir -p /tmp/testbook && cd /tmp/testbook
  2. Init the book: mdbook init
  3. Add the following to book.toml:
[output.html.fold]
enable = true
level = 0
  1. Edit SUMMARY.md:
# Summary

- [Foo](./foo/index.md)
  - [Chapter 1](./foo/chapter1.md)
  - [Chapter 2](./foo/chapter2.md)
  1. Create the files: mkdir -p src/foo && touch src/foo/{index,chapter1,chapter2}.md
  2. Build the book and load up a browser: mdbook serve -o
  3. The browser should be on the "Foo Index" page, and the subchapters are expanded,
  4. Click the collapse button on the sidebar and notice that only the headings in "Foo Index" got collapsed.

Possible Solution(s)

No response

Notes

No response

Version

mdbook v0.5.0-alpha.1

Metadata

Metadata

Assignees

Labels

A-SummaryArea: The summary page, organization of pages.C-bugCategory: A bug, incorrect or unintended behaviorP-highPriority: high

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions