quarto-dev / quarto-dev/quarto-cli

Quarto book: multiple chapters in one qmd chapter

Open
#1,712 6 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Nov 15, 2022.

books enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Quarto version: I tried a few version. Started with 1.0.37 then I updated to the latest dev version (says 99.9.9) using this

git clone https://github.com/quarto-dev/quarto-cli
cd quarto-cli
./configure-macos.sh

Then went back to v1.0.38 by re-installing.
RStudio: 2022.02.2
OS: Mac Big Sur 11.6.2

This is specific to a Quarto book project.

If have 2 h1 headers in a chapter qmd, the first appears in TOC and the others appear with the right sequential chapter numbers but don't appear in the TOC and later chapters don't "know" about the new chapters.

Example _quarto.yml

project:
  type: book

book:
  title: "test"
  chapters:
    - index.qmd
    - chap1and2.qmd
    - chap3.qmd

format:
  html:
    theme: cosmo

chap1and2.qmd

# Chapter 1

This is chapter 1

# Chapter 2

This is chapter 2

This is the output. Notice the TOC.
image

quarto check Output
[✓] Checking Quarto installation......OK
      Version: 1.0.37
      Path: /Applications/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.12
      Path: /opt/homebrew/opt/python@3.9/bin/python3.9
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.1.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/eli.holmes/Library/R/x86_64/4.1/library
        - /Library/Frameworks/R.framework/Versions/4.1/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK
quarto tools check Output
[✓] Inspecting tools

Tool         Status                    Installed     Latest  
chromium     Not installed             ---           869685  
tinytex      External Installation     ---           v2022.08
Use case, why is this needed?

In report writing situation, you often don't know how many chapters (appendices) you will need. You are using knit_expand() with an child.Rmd that is creating all your chapters (appendices) based on the data (which vary). That knit_expand() is a for loop (or map function) and is creating the markdown dynamically. This works fine in Quarto...except that it doesn't recognize the later h1 levels as proper chapters.

Checklist
  • formatted your issue so it is easier for us to read?
  • included a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • documented the quarto version you're running, by pasting the output from running quarto check in the "Quarto Check Output" text area?
  • documented the version of the quarto tools you're running, by providing the output from running quarto tools check in the "Quarto Tools Check Output" text area?
  • documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • documented which operating system you're running? If on Linux, please provide the specific distribution as well.
  • upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.