Skip to content

Support for child documents #261

Open
@p-gw

Description

@p-gw

Hi,

I am trying to figure out if child documents are supported by QuartoNotebookRunner.
The following simple example is supported by quartos native include mechanism.
The complex example I could not get to work yet.

Simple example

I want to render the top-level document defined below.

---
title: Top-Level document
engine: julia
---

Test.

{{< include _partial.qmd >}}

where _partial.qmd is defined as follows.

Partial document. 

It includes julia code, 1+1=`{julia} 1+1`.

Crucially the partial document has some code in it.
Including it evaluates the code and produces the correct output.

Complex example

In this example the I have the same setup as before, but the partial document is included/evaluated several times with different parameters.

For example,

---
title: Top-level document
engine: julia
---

Test.

```{julia}
for i in 1:3
    # code for including the child document
end
```

and the child document references the variable i.

# Heading `{julia} i`

`{julia} 1+i`

Clearly the child documents have to be rendered using the current value of i in the parent document.
I am not sure how I can render the child documents dynamically and include them in the top-level document.
The knitr engine provides the knit_child function that does exactly that.

Maybe the expand mechanism can already be used to achieve this goal?
Happy to get some suggestions.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions