Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for non-link summary items #483

Open
aturon opened this issue Nov 10, 2017 · 10 comments
Open

Allow for non-link summary items #483

aturon opened this issue Nov 10, 2017 · 10 comments
Labels
A-Internal-representation Area: Internal Representation A-Rendering Area: Rendering A-Style Area: Style (CSS, etc.) S-Wishlist Status: Wishlist

Comments

@aturon
Copy link
Member

aturon commented Nov 10, 2017

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
Copy link
Member Author

aturon commented Nov 10, 2017

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

@budziq
Copy link
Contributor

budziq commented Nov 10, 2017

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 budziq added A-Internal-representation Area: Internal Representation A-Rendering Area: Rendering A-Style Area: Style (CSS, etc.) S-Wishlist Status: Wishlist labels Nov 10, 2017
@Michael-F-Bryan
Copy link
Contributor

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

@budziq
Copy link
Contributor

budziq commented Nov 11, 2017

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

@Michael-F-Bryan
Copy link
Contributor

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.

@budziq
Copy link
Contributor

budziq commented Nov 11, 2017

Yeah lets reduce some of that technical debt first

@JHBitencourt
Copy link

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

@flexibeast
Copy link

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

@sifran-github
Copy link

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?

@jzohrab
Copy link

jzohrab commented Jan 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Internal-representation Area: Internal Representation A-Rendering Area: Rendering A-Style Area: Style (CSS, etc.) S-Wishlist Status: Wishlist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants