quarto-dev / quarto-dev/quarto-cli

Better document where project paths (starting with `/` to get to project root) can be used

Open
#3,788 1 comment 4 reactions 1 assignee View on GitHub

@cwickham is already working on this.

Since Apr 24, 2023.

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

Description

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/3784

Originally posted by edalfon December 29, 2022
Hi,

We use includes to re-use content across documents in a Quarto website project.

In this project, we set the option execute-dir: project to keep the working directory for computations pinned to the root directory of the project. That way, for example, all documents can refer to ./data/fancy_data, regardless of which subfolder they are placed in. For us this is important because we organize the content of the project in a bunch of subfolders that can go nested to different depth. Without the execute-dir: project the project would simply be much harder to mantain and keep track of the paths we should use in each document.

We expected {{< include >}} to follow the same project's execute-dir option, but it doesn't seem so. Instead, it always resolves to the same folder of the file you are including content in. So if you are in a subfolder and whant to include some content in the root of the project, you cannot do this {{< include _codebit.qmd>}}, but you have to do something like this {{< include ../../../_codebit.qmd>}}. And the ../../... part would depend on where the document lives and if you decide to reorganize the structure of the documents, you would need to update that as well. So, it is a bit of a mess.

We couldn't find a way around this or any other option similar to execute-dir, but for the whole working directory of the project and not only for computations.

Wouldn't it be better to have the includes directive to follow the execute-dir option?, is there currently any way to do it?

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.