Skip to content

Commit b5d3c82

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 b5d3c82

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-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,11 @@
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+
a little test

0 commit comments

Comments
 (0)