mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Allow for non-link summary items

Open aturon opened this issue 8 years ago • 10 comments

I'd like to have a layout like this:

  1. A chapter about foo
  • Section 1
  • Section 2
  1. 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.

aturon avatar Nov 10 '17 21:11 aturon

In particular, I'm going for something like this: https://tokio.rs/docs/getting-started/tokio/

aturon avatar Nov 10 '17 21:11 aturon

This can be somewhat achieved already as it is: untitled

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?

budziq avatar Nov 10 '17 22:11 budziq

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...

Michael-F-Bryan avatar Nov 11 '17 03:11 Michael-F-Bryan

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")

budziq avatar Nov 11 '17 07:11 budziq

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.

Michael-F-Bryan avatar Nov 11 '17 08:11 Michael-F-Bryan

Yeah lets reduce some of that technical debt first

budziq avatar Nov 11 '17 16:11 budziq

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

JHBitencourt avatar Mar 19 '20 14:03 JHBitencourt

+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.

flexibeast avatar Jul 22 '20 03:07 flexibeast

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?

sifran-github avatar Dec 11 '23 11:12 sifran-github

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:

image

jzohrab avatar Jan 31 '24 09:01 jzohrab