3

I'm using quarto to create revealjs slides. I have a main file science.qmd that looks similar to this

---
title: "title"
author: "me"
date: "2023-09-01"
toc: false
chalkboard: true
---


{{< include slides/_basics.qmd >}}
{{< include slides/_datenbasiert.qmd >}}
{{< include slides/_bias.qmd >}}

I.e., this file is purely thought of as the driver, and the main content is stored inside the _*.qmd files.

My _quarto.yml looks like this:


project:
  title: "title"
  output-dir: docs
  preview:
    port: 4200
    browser: true
    watch-inputs: true

execute:
  freeze: auto  # re-render only when source changes
  # cache: true

editor:
  render-on-save: true

format:
  revealjs:
    theme: [default,styles.scss]
    highlight-style: dracula
    code-line-numbers: true
    code-fold: false
    code-tools: true
    code-copy: true
    navigation-mode: vertical
    controls-layout: bottom-right
    controls-tutorial: true

Now I run

poetry run quarto preview /Users/me/Repos/myfolder --render all

To render the presentation.

My problem is that I am unable to trigger a re-render in the case that the contents of the _*.qmd files is changed. I have enabled "Render on save" and whenever I change the content of the science.qmd file, it also runs the re-rendering.

Can I force the presentation to re-render whenever I change one of the included .qmd files?

Thomas
  • 1,199
  • 1
  • 14
  • 29
  • What about a [targets](https://books.ropensci.org/targets/literate-programming.html) pipeline? – Julian Aug 23 '23 at 13:47

1 Answers1

-3

It appears that you are using Quarto to generate reveal.js presentations from Markdown files and you want to trigger a re-render whenever one of the included _*.qmd files changes. Quarto should automatically handle re-rendering when the included files change, but if it's not working as expected, you can try the following steps to ensure that the rendering process updates when the included files are modified:

  1. Check Quarto Version: Ensure that you are using a version of Quarto that supports automatic re-rendering on file changes. Quarto may have received updates that improve this feature. You can check for updates by running:

    poetry update quarto
    
  2. Check YAML Configuration: Ensure that your _quarto.yml configuration is correctly set up to enable automatic re-rendering:

    execute:
      freeze: auto  # re-render only when source changes
    editor:
      render-on-save: true
    

    The freeze: auto option should trigger re-rendering when source files change. The render-on-save: true option should trigger re-rendering when you save a file.

  3. Check File Inclusion: Make sure that the _*.qmd files are correctly included in your science.qmd file using the Quarto include syntax. For example:

    {{< include slides/_basics.qmd >}}
    {{< include slides/_datenbasiert.qmd >}}
    {{< include slides/_bias.qmd >}}
    

    Ensure that the file paths are correct and relative to the location of your science.qmd file.

  4. Check File Permissions: Ensure that you have the necessary read permissions for the included files, so Quarto can monitor changes in those files.

  5. File System Watching: Quarto relies on the file system watching mechanism to detect changes in included files. Sometimes, issues with file system watching can prevent updates. Ensure that your operating system and file system support the file watching mechanism properly.

  6. Rebuild or Clean: In some cases, you may want to try rebuilding your project or cleaning the project's cache to force a full re-render:

    poetry run quarto clean /Users/me/Repos/myfolder
    poetry run quarto render /Users/me/Repos/myfolder
    

    This will clear any cached data and force a re-render of all files.

  7. Debugging: If the issue persists, consider running Quarto in debug mode to get more information about what's happening under the hood. You can use the --verbose or --debug option when running Quarto to see detailed logs.

    poetry run quarto preview /Users/me/Repos/myfolder --render all --verbose
    

    Review the logs for any error messages or information related to file monitoring and rendering.

By following these steps, you should be able to ensure that Quarto re-renders your presentation whenever the included _*.qmd files are changed. If you continue to face issues, you may want to consult Quarto's documentation or community forums for additional support.

Divanshu
  • 423
  • 3
  • 12