Define list of chapters with 'wildcards'

Hi there,

I'm working on the large quarto book project. To make it more manageable, I put my chapters into a subfolder and named files with sequential names (e.g., 'chapter1'.qmd, 'chapter2.qmd', etc.). As the number of chapters gets closer to 100, I start wondering if I can define the list of chapters in the yaml file using 'wildcards' in the way similar to the Project render sections.

What I want:

book:
  chapters:
      - index.qmd
      - chapters/chapter_*.qmd

instead of

book:
  chapters:
      - index.qmd
      - chapters/chapter_1.qmd
      - chapters/chapter_2.qmd
      .....
      - chapters/chapter_101.qmd
      - chapters/chapter_102.qmd

Example from Quarto website for project rendering:

If you don’t want to render all of the target documents in a project, or you wish to control the order of rendering more precisely, you can add a project: render: [files] entry to your project metadata. For example:

project:
  render:
    - section1.qmd
    - section2.qmd

Note that you can use wildcards when defining the render list. For example:

project:
  render:
    - section*.qmd

Would appreciate any suggestions and workarounds.
Thanks in advance

If there is not one already, you should open a feature request GitHub - quarto-dev/quarto-cli: Open-source scientific and technical publishing system built on Pandoc.

Would appreciate any suggestions and workarounds.

You could have a script to dynamically create your _quarto.yml based on a template or created using a YAML library. The _quarto.yml file does not update often usually, you could use your prefered language or use quarto run to run an update script to fill in all your chapters.

Just an idea.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.