quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.77k stars 308 forks source link

Sidebar Navigation Contents Option Not Working in Book Projects #10594

Open IULibScholComm opened 4 weeks ago

IULibScholComm commented 4 weeks ago

Bug description

My book has 50+ chapters, so I'm hoping to use Sidebar Contents described here and here to display in the book's sidebar a hierarchy of chapters. However, while the Contents option works in Website projects (see screenshot), it is not working in Book projects (see screenshot), despite the documentation claiming that it does. Basically, to my eyes it looks like in book projects, the yml Chapter metadata interferes with the sidebar customization (despite the documentation saying otherwise), whereas in website projects, the absence of yml Chapter metadata enables the sidebar to be customized.

sidebar in website project (i.e., correct)


sidebar in book project (i.e., error)


Steps to reproduce

Screenshot 2: Book (Error)


project:
  type: book

book: 
  chapters: 
    - index.qmd
  sidebar: 
    contents: 
      - text: "Front Matter"
        href: "index.qmd"
      - section: "Part I"

# Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

Screenshot 1: Website (Works Correctly)


project:
  type: website

website: 
  sidebar: 
    contents: 
      - text: "Front Matter"
        href: "index.qmd"
      - section: "Part I"

# Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

Expected behavior

The chapters in the sidebar of the book should be rendered as they are in the website: i.e., in a hierarchy with customized names.

Actual behavior

The sidebar contents option does not work in the book project.

Your environment

Quarto check output


Quarto 1.6.4
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.4
      Path: C:\Users\amazel\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: v2024.07.03
      Chromium: 869685

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\amazel\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2024

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.11.4
      Path: C:/Users/amazel/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: 5.5.0
      Kernels: ir, python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.4.1
      Path: C:/PROGRA~1/R/R-44~1.1
      LibPaths:
        - C:/Program Files/R/R-4.4.1/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")
mcanouil commented 4 weeks ago

Could you properly format your post using code blocks for code and terminal outputs? Thanks. If your code contains code blocks, you need to enclose it using more backticks, i.e., usually four ````. See https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us.

cscheid commented 4 weeks ago

My yml is below; please let me know if I should provide anything further.

We always do need a full reproduction, and not just the part you think causes the bug.

IULibScholComm commented 4 weeks ago

@mcanouil @cscheid I apologize for my errors (I'm new at this and hoping to learn); have I fixed them? Thank you!

IULibScholComm commented 3 weeks ago

@cscheid I believe this bug report is ready to be looked into, as I think I've provided a full reproduction. Please let me know if anything further is needed.

Thank you, and sorry for my earlier error!

cscheid commented 3 weeks ago

The repro isn't full, unfortunately - I'm trying to figure out how you got the first screenshot, and I can't (I tried to replace type: book with type: website in your provided _quarto.yml.

Can you give us a git repository with two separate Quarto projects so we can render them from your git repository without having to guess your file structure? This feels strict, but we otherwise do not know how you've arrived at what you're looking at.

IULibScholComm commented 3 weeks ago

@cscheid I am sorry about that (I am new at this), and thank you for bearing with me!

The information you requested should now be both in the issue above and at this repository. Please let me know if you have everything needed. Thank you!

IULibScholComm commented 3 weeks ago

@cscheid Hi--I'm just checking in about this issue; have I provided above everything that you need? Thank you!

cscheid commented 3 weeks ago

We will get back to you when we have time to do so. Please be patient.

mcanouil commented 1 week ago

So I can repro but I am not sure the sidebar.contents is actually supported in Book format as the chapters are sent to the sidebar.

To me it's a documentation issue: the first link is auto-generated and might not have the right scope for all options such as sidebar.contents (no where to be found in book codebase), the second link is for websites not books.

mcanouil commented 1 week ago

Now, what I don't understand is why not using parts? https://quarto.org/docs/books/book-structure.html#parts-appendices

IULibScholComm commented 1 week ago

Now, what I don't understand is why not using parts? https://quarto.org/docs/books/book-structure.html#parts-appendices

Thank you for looking into this! Treating it as a documentation issue makes sense. I would use Parts, but this book will be published as and EPUB as well as HTML, and Parts unfortunately do not work in EPUB format.