mdBook
mdBook copied to clipboard
Allow for non-link summary items
I'd like to have a layout like this:
- A chapter about foo
- Section 1
- Section 2
- A chapter about bar
- Section 1
- Section 2
where the top-level chapter items are not links, but rather, each chapter begins with the first subsection.
In particular, I'm going for something like this: https://tokio.rs/docs/getting-started/tokio/
This can be somewhat achieved already as it is:

with empty SUMMARY.md links although the styling will be off.
# Summary
- [mdBook](README.md)
- [Command Line Tool](cli/cli-tool.md)
- [init](cli/init.md)
- [build](cli/build.md)
- [watch](cli/watch.md)
- [Non existing top level]()
- [serve](cli/serve.md)
- [Non existing]()
- [test](cli/test.md)
- [Format](format/format.md)
- [SUMMARY.md](format/summary.md)
- [Configuration](format/config.md)
Short term and ugly solution is to change the css. Cleaner solution is to add another type of SUMMARY.md links.
Just to be clear. Are you thinking about TOC on the sidebar or a TOC on the actual page content?
What about saying if a summary item's link points to some special value (e.g. [My Item](!)) then we add a CSS class that renders it differently?
I'm not sure how this would interact with the internal representation of a book though. I'm pretty sure at the moment each chapter/item must point to a file...
What about saying if a summary item's link points to some special value (e.g. My Item
All things being equal i would suggest to use standard markdown ontology here. Like in the case of separator items ("=========") we could just add support for standard non-linked list items ("- Some Item" vs "- Linked chapter")
That sounds like a really nice solution! If we just have a normal list item with text instead of with a link then that's both intuitive and easy enough to handle.
It'd probably be easier to implement when we land #409 though.
Yeah lets reduce some of that technical debt first
Currently this is not possible. If i have this structure:
# Summary
- [mdbook](./mdbook.md)
- [test]()
- [test2](./test2)
I'll get this error while running mdbook build:
% mdbook build
2020-03-19 11:21:24 [ERROR] (mdbook::utils): Error: Summary parsing failed
2020-03-19 11:21:24 [ERROR] (mdbook::utils): Caused By: There was an error parsing the numbered chapters
2020-03-19 11:21:24 [ERROR] (mdbook::utils): Caused By: Error at line 4, column 3: You can't have an empty link.
I would like to have sections without links though..
mdbook --version = mdbook v0.3.5
+1 for this. In the Void Handbook, we currently have "sections" like this, which our users find problematic. In a number of cases, we've been able to consolidate information to avoid such sections, but it would be nice to have 'virtual chapters' as described in #592.
Any update on this old issue? is it possible to create a directory without linking to a page? and without using parentheses () thus making it a non existing item that takes the "--sidebar-non-existant" css?
This is an old issue, but in case anyone is looking for this I am currently using a workaround hack that suffices.
My summary has this:
- [chap heading]()
- [item 1](./somedir/blah.md)
- [item 2](./somedir/blah2.md)
with the following css:
li.chapter-item div {
font-style: italic;
color: rgb(200, 201, 219);
}
included in my book.toml with:
[output.html]
...
additional-css = ["css/custom.css"]
rendering stuff like this: