diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 5de0719dc2f..919da4b5126 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -79,6 +79,10 @@ All changes included in 1.8: - [#13316](https://github.com/quarto-dev/quarto-cli/issues/13316): `code-line-numbers: "1"` correctly highlight the first line now. +### `markdown` formats + +- ([#12630])(https://github.com/quarto-dev/quarto-cli/issues/12630)): emit image element for `video` shortcodes targeting local videos. + ## Projects ### `website` diff --git a/src/resources/extensions/quarto/video/video.lua b/src/resources/extensions/quarto/video/video.lua index e23740735e4..bb51912900b 100644 --- a/src/resources/extensions/quarto/video/video.lua +++ b/src/resources/extensions/quarto/video/video.lua @@ -346,6 +346,15 @@ return { return htmlVideo(srcValue, heightValue, widthValue, titleValue, startValue, aspectRatio) elseif quarto.doc.is_format("asciidoc") then return asciidocVideo(srcValue, heightValue, widthValue, titleValue, startValue, aspectRatio) + elseif quarto.doc.is_format("markdown") then + if srcValue:sub(1, 4) == "http" then + -- For remote videos, we can emit a link + return pandoc.Link(srcValue, titleValue or srcValue) + else + -- For local + -- use an image to allow markdown previewers to show video + return pandoc.Image(quarto.utils.as_inlines(titleValue), srcValue) + end else -- Fall-back to a link of the source return pandoc.Link(srcValue, srcValue) diff --git a/tests/docs/smoke-all/2025/09/03/issue-12630.qmd b/tests/docs/smoke-all/2025/09/03/issue-12630.qmd new file mode 100644 index 00000000000..7cbb9c0dd28 --- /dev/null +++ b/tests/docs/smoke-all/2025/09/03/issue-12630.qmd @@ -0,0 +1,11 @@ +--- +title: hello +_quarto: + tests: + gfm: + ensureFileRegexMatches: + - - "\\!\\[\\]\\(local.mp4\\)" + - [] +--- + +{{< video local.mp4 >}} \ No newline at end of file