Skip to content

Troubles with child documents #95

@J-Moravec

Description

@J-Moravec

I am trying to template my report a bit, but also keep everything clean by placing child documents in their own folder.

It seems that the children are evaluated in the current folder, but the link path is constructed under the idea that they are evaluated in the child's folder.

To me it looks like the path for the figures and path for links is created by entirely different set of functions with their own ruleset and expectations, since this is the second error I am having in his area.

I tried to look if I could solve it by running a new fuse within the chunk, but while some set of parameters is carried over, other set is generated anew, which makes it hard to know what is going on.

My parent document main.rmd looks like this:

---
title: Test children documents
output:
    html:
        keep_md: true
---

## This is parent report

```{r}
plot(1)
```

```{r, child = "children/child.rmd"}
```

```{r, results = "asis", echo = FALSE}
r = litedown::reactor()
ro = as.list(r)
r$echo = TRUE
cat(litedown::fuse("children/child.rmd", output = "markdown"))
litedown::reactor(ro)
```

My child document children/child.rmd looks like this:

## Child

This is a child report

```{r}
plot(2)
```

Note, the child documents are placed in a different folder.

The output markdown file looks as follows:

---
title: Test children documents
output:
    html:
        keep_md: true
---

## This is parent report

``` {.r}
plot(1)
```
![](<main__files/chunk-1-1.png>)

## Child

This is a child report

``` {.r}
plot(2)
```
![](<../main__files/chunk-2-1-1.png>)

## Child

This is a child report
 ``` {.r}
plot(2)
```
![](<../main__files/chunk-1-1.png>)

Setting setwd() in the asis block didn't fix stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions