Skip to content

Commit 9b9476d

Browse files
committed
Escape revealjs lib url in metadata using new pandoc-native inline
this was introduced in #9159 and help solve case like this where we need to prevent pandoc from parsing as Markdown the metadata fields passed in the YAML file used with `metadata-file:` For context about `--metadata-file` see https://pandoc.org/MANUAL.html#option--metadata-file > Read metadata from the supplied YAML (or JSON) file. This option can be used with every input format, but string scalars in the metadata file will always be parsed as Markdown.
1 parent 6388f4a commit 9b9476d

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

src/format/reveal/format-reveal-theme.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export async function revealTheme(
8282

8383
// compute reveal url
8484
const revealUrl = pathWithForwardSlashes(revealDir);
85-
metadata[kRevealJsUrl] = revealUrl;
85+
// escape to avoid pandoc markdown parsing from YAML default file
86+
// https://github.com/quarto-dev/quarto-cli/issues/9117
87+
metadata[kRevealJsUrl] = `${'`Str "'}${revealUrl}${'"`'}{=pandoc-native}`;
8688

8789
// copy reveal dir
8890
const revealSrcDir = revealJsUrl ||

src/format/reveal/format-reveal.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ export function revealjsFormat() {
211211
[kLinkCitations]: true,
212212
[kRevealJsScripts]: revealPluginData.pluginInit.scripts.map(
213213
(script) => {
214-
return script.path;
214+
// escape to avoid pandoc markdown parsing from YAML default file
215+
// https://github.com/quarto-dev/quarto-cli/issues/9117
216+
return `${'`Str "'}${script.path}${'"`'}{=pandoc-native}`;
215217
},
216218
),
217219
} as Metadata,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
format: revealjs
3+
_quarto:
4+
tests:
5+
revealjs:
6+
ensureHtmlElements:
7+
- ['*[src ^= "9117--issue_files/"', '*[href ^= "9117--issue_files/"']
8+
- ['*[src ^= "9117–issue_files/"', '*[href ^= "9117–issue_files/"']
9+
---
10+
11+
---
12+
title: "test "
13+
from: markdown+emoji
14+
format:
15+
revealjs:
16+
self-contained: false
17+
footer: "footer test"
18+
slide-number: c/t
19+
slide-level: 3
20+
css: style.css
21+
scrollable: true
22+
html:
23+
mermaid:
24+
theme: dark
25+
embed-resources: false
26+
link-external-icon: true
27+
link-external-newwindow: true
28+
tbl-cap-location: bottom
29+
author:
30+
name: "test"
31+
orcid: 0000-0021-7213-4711
32+
email: mr@test.com
33+
affiliations: company x
34+
date: last-modified
35+
toc: true
36+
toc-title: TOC
37+
toc-depth: 1
38+
number-sections: true
39+
execute:
40+
echo: true
41+
---
42+
43+
a little test

0 commit comments

Comments
 (0)