Skip to content

Leaf

A leaf schema is a self-closing schema with no primary attribute. They are typically used to render HTML tags that are supposed to be self-closing and use attributes as a way to make the so special things.

The ones that fall into this category are.

  • source
  • hr
  • br
  • track
  • img
  • wbr

iframe

You can use an iframe as well it's a tag that allows you to display a website inside of another website. It's a Leaf Schema with the following attributes.

md
{% iframe 
   src="https://forastro-docs.onrender.com/libraries/utilities/content-collection-helpers" 
/%}
attributetyperequired
srcSourceAttributetrue
allowAllowAttributefalse

Allow Attribute

The AllowAttribute is an attribute that looks for and object with types trequired are one or more of the following words.

  • camera
  • display-capture
  • fullscreen
  • gamepad
  • geolocation
  • microphone
  • web-share

The values of each property must be either

  • A "*".
  • A string that starts with either 'src' or 'self' and ends with a http url.

Beware

src and self must be written with quotes,

It will then transform that object into a string that places all types and required side by side.

This code will transform

md
    {% iframe 
        allow={
        camera:"'src' http://example.com"
        microphone:"'src' http://example.com"
        } 
    /%}

into this code.

html
<iframe 
    allow="camera 'src' http://example.com microphone 'src' http://example.com"
/>
Attributes
attributetyperequiredmatches
nameSourceAttributefalse
loadingStringfalse
eager
lazy
sandboxStringfalse
allow-top-navigation-to-custom-protocols
allow-top-navigation-by-user-activation
allow-top-navigation
allow-scripts
allow-same-origin
allow-popups-to-escape-sandbox
allow-popups allow-pointer-lock
allow-orientation-lock
allow-modals
allow-forms
allow-downloads
widthIntegerAttributefalse
heightIntegerAttributefalse

img

A schema that allows the use of the img tag in Markdoc.

md
{%img src="flower.jpg" /%}

This schema has supports the following global attributes.

Attributes
attributetyperequirederror levelmatches
srctruecritical
srcsettruecritical
sizestruewarning
altStringtrue
crossoriginStringfalse
anonymous
use-credentials
fetchpriorityStringfalse
high
low
auto
decodingStringfalse
auto
sync
async
loadingStringfalse
eager
lazy

track

A schema that allows the use of the track tag in Markdoc.

md
{% video %}
  {%track src="/media/examples/friday.vtt" /%}
{% /video %}
md
{% audio %}
  {%track src="track.mp4" /%}
{% /audio %}
Attributes
attributetyperequiredreferencematches
srctrue
srclangBooleanfalselang
defaultBooleanfalse
labelStringfalse
kindStringfalse
captions
chapters
descriptions
metadata
subtitles

wbr

This schema allows wbr tags to be rendered in markdoc.

md
{% wbr  /%}

br

This schema allows br tags to be rendered in markdoc.

md
{% br  /%}

hr

This schema allows hr tags to be rendered in markdoc.

md
{% hr  /%}

Released under the MIT License