Skip to content

Is the SUMMARY.md parser too flexible? #2588

Open
@szabgab

Description

@szabgab

Question

I was trying to create a test for the Summary parsing failed error in book.rs, but so far it parsed everything.
Sometimes not as I expected, but I could not create a SUMMARY.md file that would fail to parse.

Here is one thing that seems to be odd. These example all generate the same thing (two prefix chapters)

Both starting on the 1st column

[A](./a.md)
[B](./b.md)

B Starting indented (the

[A](./a.md)
  [B](./b.md)
[A](./a.md) [B](./b.md)

Even when there are 1-3 leading spaces

  [A](./a.md) [B](./b.md)

However, when there are 4 leading spaces, then these entries are disregarded

    [A](./a.md) [B](./b.md)

This is also accepted:

[A](./a.md)
- [B](./b.md)
[C](./c.md)
- [D](./d.md)
[E](./e.md)

My understanding of the docs is that you cannot have a prefix (like) chapter after the first numbered chapter.

The result is

A
1. B
2. D

without error.

IMHO mdbook should have stricter rules and it should report errors instead of just disregarding things.

Version

0.4.46

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SummaryArea: The summary page, organization of pages.C-questionCategory: A question on how to do something

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions