Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: add back floating outline (#6933)

Myles Scolnick70df9e34b0fc
diff --git a/frontend/src/core/dom/__tests__/outline.test.ts b/frontend/src/core/dom/__tests__/outline.test.ts
index 008303969d..7609322ace 100644
--- a/frontend/src/core/dom/__tests__/outline.test.ts
+++ b/frontend/src/core/dom/__tests__/outline.test.ts
@@ -137,6 +137,49 @@ describe("parseOutline", () => {
`);
});
+ it("can parse markdown outline", () => {
+ const markdown = `
+ <span class="markdown">
+ <h1 id="introduction">Introduction</h1>
+ <h2 id="getting-started">Getting Started</h2>
+ <h3 id="installation">Installation</h3>
+ </span>
+ `;
+ const outline = parseOutline({
+ mimetype: "text/markdown",
+ timestamp: 0,
+ channel: "output",
+ data: markdown,
+ });
+ expect(outline).toMatchInlineSnapshot(`
+ {
+ "items": [
+ {
+ "by": {
+ "id": "introduction",
+ },
+ "level": 1,
+ "name": "Introduction",
+ },
+ {
+ "by": {
+ "id": "getting-started",
+ },
+ "level": 2,
+ "name": "Getting Started",
+ },
+ {
+ "by": {
+ "id": "installation",
+ },
+ "level": 3,
+ "name": "Installation",
+ },
+ ],
+ }
+ `);
+ });
+
it("can handle non-html outline", () => {
const html = "foo";
const outline = parseOutline({
diff --git a/frontend/src/core/dom/outline.ts b/frontend/src/core/dom/outline.ts
index 97c143e762..55ff5511aa 100644
--- a/frontend/src/core/dom/outline.ts
+++ b/frontend/src/core/dom/outline.ts
@@ -68,7 +68,7 @@ export function parseOutline(output: OutputMessage | null): Outline | null {
return null;
}
- if (output.mimetype !== "text/html") {
+ if (output.mimetype !== "text/html" && output.mimetype !== "text/markdown") {
return null;
}