1. Introduction
  2. User Guide
  3. 1. Installation
  4. 2. Get Started
  5. 3. Frequently Asked Questions
  6. 4. Further reading
  7. Reference Guide
  8. 5. Command Line Tool
    1. 5.1. init
    2. 5.2. build
    3. 5.3. serve
    4. 5.4. clean
    5. 5.5. completions
  9. 6. Format
    1. 6.1. book.typ
      1. 6.1.1. Book Metadata
        1. 6.1.1.1. Draft chapter
      2. 6.1.2. Build Metadata
    2. 6.2. Theme
    3. 6.3. Typst Support
      1. 6.3.1. Cross Reference
        1. 6.3.1.1. Cross Reference Sample
      2. 6.3.2. Embed Sanitized HTML Elements
        1. 6.3.2.1. Multimedia components
      3. 6.3.3. Semantic Page Description
    4. 6.4. Rendering Tests
  10. 7. For developers
    1. 7.1. Typst-side APIs
    2. 7.2. shiroa CLI Internals
    3. 7.3. Alternative Backends

shiroa

#

media module

There are a few media components provided by media module.

  • iframe: Embed an iframe in the document.
  • video: Embed a video in the document.
  • audio: Embed an audio in the document.
  • div: Embed a div in the document.

Example:


        
#media.iframe(

        
  outer-width: 640pt,

        
  outer-height: 360pt,

        
  attributes: (

        
    src: "https://player.bilibili.com/player.html?aid=80433022&bvid=BV1GJ411x7h7&cid=137649199&page=1&danmaku=0&autoplay=0",

        
    scrolling: "no",

        
    border: "0",

        
    width: "100%",

        
    height: "100%",

        
    frameborder: "no",

        
    framespacing: "0",

        
    allowfullscreen: "true",

        
  ),

        
)

        
#media.iframe(

        
  outer-width: 640pt,

        
  outer-height: 360pt,

        
  attributes: (

        
    src: "https://player.bilibili.com/player.html?aid=80433022&bvid=BV1GJ411x7h7&cid=137649199&page=1&danmaku=0&autoplay=0",

        
    scrolling: "no",

        
    border: "0",

        
    width: "100%",

        
    height: "100%",

        
    frameborder: "no",

        
    framespacing: "0",

        
    allowfullscreen: "true",

        
  ),

        
)

Check the Multimedia Components to see the result of the above code.

Explaination:

  • outer-width and outer-height gives a the size to render at the position. You can either use the shiroa.page-width or std.layout to determine a proper size.
  • The media components currently doesn't get render in PDF output, so you have to provide the alternative content when is-pdf-target is true.