Skip to content

Commit

Permalink
Correctly check when format is only a string and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv committed Dec 22, 2023
1 parent 1e1456d commit 9f0c42f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/jupyter/jupyter-fixups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,15 @@ export function fixupFrontMatter(nb: JupyterNotebook): JupyterNotebook {
}
});

// if we have front matter and a title then we are done
const yaml = partitioned ? readYamlFromMarkdown(partitioned.yaml) : undefined;
if (yaml?.title || yaml?.format?.["revealjs"]) {
if (
// if we have front matter and a title then we are done
yaml?.title ||
// if we have front matter and it has revealjs as a format then we are done too
(yaml?.format !== null &&
(yaml?.format === "revealjs" ||
(typeof yaml?.format === "object" && "revealjs" in yaml?.format)))
) {
return nb;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
format: revealjs
_quarto:
tests:
revealjs:
ensureHtmlElements:
- ['div.slides > section#custom:first-child']
- []
ensureFileRegexMatches:
- []
- []
---

## My Title slide {#custom .center}

Some content


## Python slide

```{python}
print(2+2)
```

0 comments on commit 9f0c42f

Please sign in to comment.