Skip to content

Commit 027f711

Browse files
authored
Merge pull request #13327 from quarto-dev/enhancement/12630
shortcode,video - emit image for local videos in markdown output
2 parents 52a3bf9 + c31c760 commit 027f711

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

news/changelog-1.8.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ All changes included in 1.8:
7979

8080
- [#13316](https://github.com/quarto-dev/quarto-cli/issues/13316): `code-line-numbers: "1"` correctly highlight the first line now.
8181

82+
### `markdown` formats
83+
84+
- ([#12630])(https://github.com/quarto-dev/quarto-cli/issues/12630)): emit image element for `video` shortcodes targeting local videos.
85+
8286
## Projects
8387

8488
### `website`

src/resources/extensions/quarto/video/video.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,15 @@ return {
346346
return htmlVideo(srcValue, heightValue, widthValue, titleValue, startValue, aspectRatio)
347347
elseif quarto.doc.is_format("asciidoc") then
348348
return asciidocVideo(srcValue, heightValue, widthValue, titleValue, startValue, aspectRatio)
349+
elseif quarto.doc.is_format("markdown") then
350+
if srcValue:sub(1, 4) == "http" then
351+
-- For remote videos, we can emit a link
352+
return pandoc.Link(srcValue, titleValue or srcValue)
353+
else
354+
-- For local
355+
-- use an image to allow markdown previewers to show video
356+
return pandoc.Image(quarto.utils.as_inlines(titleValue), srcValue)
357+
end
349358
else
350359
-- Fall-back to a link of the source
351360
return pandoc.Link(srcValue, srcValue)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: hello
3+
_quarto:
4+
tests:
5+
gfm:
6+
ensureFileRegexMatches:
7+
- - "\\!\\[\\]\\(local.mp4\\)"
8+
- []
9+
---
10+
11+
{{< video local.mp4 >}}

0 commit comments

Comments
 (0)