diff --git a/contrib/templates/xhtml/lib.typ b/contrib/templates/xhtml/lib.typ new file mode 100644 index 00000000..9612d364 --- /dev/null +++ b/contrib/templates/xhtml/lib.typ @@ -0,0 +1,45 @@ + +/// HTML extension +#let xhtml(outer-width: 1024pt, outer-height: 768pt, inner-width: none, inner-height: none, content) = { + let t = content.func() + let content = if content.func() == raw { + content.text + } else { + content + } + + let inner-width = if inner-width == none { + outer-width + } else { + inner-width + } + + let inner-height = if inner-height == none { + outer-height + } else { + inner-height + } + + let html-embed = { + "" + "" + content + "" + "" + } + + image.decode(html-embed, alt: "!typst-inlined-svg") +} diff --git a/fuzzers/corpora/visualize/video_00.typ b/fuzzers/corpora/visualize/video_00.typ index 9325d6a7..6c784c2c 100644 --- a/fuzzers/corpora/visualize/video_00.typ +++ b/fuzzers/corpora/visualize/video_00.typ @@ -1,16 +1,23 @@ -#image.decode(``` - - - -```.text, alt: "!typst-inlined-svg") +#import "/contrib/templates/xhtml/lib.typ": xhtml + +#set page(height: auto, width: auto) + += Multi-media in Typst + +This is a embed video. + +#xhtml(outer-width: 640pt, outer-height: 360pt, ```html + +```) + +That is a embed video.