Skip to content

Commit 0aed909

Browse files
authored
Merge pull request #10189 from quarto-dev/bugfix/inspect-project
`quarto inspect` - fix directory handling
2 parents 100b913 + 63bff31 commit 0aed909

11 files changed

Lines changed: 49 additions & 1 deletion

File tree

news/changelog-1.6.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
All changes included in 1.6:
22

3+
## `quarto inspect`
34

5+
- ([#10188](https://github.com/quarto-dev/quarto-cli/issues/10188)): `quarto inspect` properly resolves includes across subdirectory boundaries.

src/project/project-shared.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ export async function projectResolveCodeCellsForFile(
390390
if (directiveCell.name !== "include") {
391391
continue;
392392
}
393-
const innerFile = join(project.dir, directiveCell.shortcode.params[0]);
393+
const arg = directiveCell.shortcode.params[0];
394+
const paths = arg.startsWith("/")
395+
? [project.dir, arg]
396+
: [project.dir, relative(project.dir, dirname(file)), arg];
397+
const innerFile = join(...paths);
394398
await inner(
395399
innerFile,
396400
(await breakQuartoMd(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
/_site/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "inspect-test"
6+
navbar:
7+
left:
8+
- href: index.qmd
9+
text: Home
10+
- about.qmd
11+
12+
format:
13+
html:
14+
theme: cosmo
15+
css: styles.css
16+
toc: true
17+
18+
19+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{< include /_test2.md >}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test2.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "About"
3+
---
4+
5+
About this site
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{< include _bar.md >}}
2+
3+
{{< include /_test.md >}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "inspect-test"
3+
---
4+
5+
This is a Quarto website.
6+
7+
To learn more about Quarto websites visit <https://quarto.org/docs/websites>.
8+
9+
{{< include _test.md >}}

0 commit comments

Comments
 (0)