Skip to content

Commit 1ef1504

Browse files
claude: Add test for sidebar auto-generation with ipynb index
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 79b4cc1 commit 1ef1504

5 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.quarto/
2+
**/*.quarto_ipynb
3+
*_files/
4+
_site/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Sidebar Auto Test"
6+
sidebar:
7+
contents: auto
8+
9+
format:
10+
html:
11+
theme: default
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Home"
3+
---
4+
5+
This is the home page.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "raw",
5+
"metadata": {},
6+
"source": [
7+
"---\n",
8+
"title: \"Subdir Index\"\n",
9+
"---"
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"This is the index page for the subdir."
17+
]
18+
}
19+
],
20+
"metadata": {
21+
"kernelspec": {
22+
"display_name": "Python 3",
23+
"language": "python",
24+
"name": "python3"
25+
},
26+
"language_info": {
27+
"name": "python",
28+
"version": "3.9.0"
29+
}
30+
},
31+
"nbformat": 4,
32+
"nbformat_minor": 4
33+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* website-sidebar-auto.test.ts
3+
*
4+
* Verifies that sidebar auto-generation properly detects index files with
5+
* non-qmd extensions (like .ipynb) in subdirectories. This tests the
6+
* engineValidExtensions() call in indexFileHrefForDir() which must work
7+
* before resolveEngines() has been called.
8+
*
9+
* Copyright (C) 2020-2025 Posit Software, PBC
10+
*/
11+
12+
import { docs } from "../../utils.ts";
13+
import { join } from "../../../src/deno_ral/path.ts";
14+
import { existsSync } from "../../../src/deno_ral/fs.ts";
15+
import { testQuartoCmd } from "../../test.ts";
16+
import { fileExists, noErrorsOrWarnings } from "../../verify.ts";
17+
18+
const renderDir = docs("websites/website-sidebar-auto");
19+
const outDir = join(Deno.cwd(), renderDir, "_site");
20+
21+
// Test that sidebar auto-generation detects index.ipynb in subdirectory
22+
testQuartoCmd(
23+
"render",
24+
[renderDir],
25+
[
26+
noErrorsOrWarnings,
27+
fileExists(join(outDir, "index.html")), // Main index page
28+
fileExists(join(outDir, "subdir", "index.html")), // Subdir index from .ipynb should be rendered
29+
],
30+
{
31+
teardown: async () => {
32+
if (existsSync(outDir)) {
33+
await Deno.remove(outDir, { recursive: true });
34+
}
35+
},
36+
},
37+
);

0 commit comments

Comments
 (0)