Rich Content
Jake G May 15, 2021 #Features #Video #Audio #Images #ShortcodesSeveral custom shortcodes are included to augment CommonMark. video, image, gif, and audio were created to help you take advantage of modern HTML elements in your writing.
Video
sourcesis an array of video file paths. (mandatory)classsets a class for the video.captionsets the caption text below the video.wsets the width of the video.hsets the height of the video.autoplaywhen set, autoplays the video on load.loopwhen set, plays the video on a loop.mutedwhen set, sets the audio muted initially.playsinlinewhen set, plays the video embeded instead of fullscreen on mobile browsers.
sources can be same path, relative path, or root path, like the img shortcode
Optional Classes:
cican be used to center the image.frcan be used to float the image right.flcan be used to float the image left.b1can be used to add a 1px border.
Usage
Output
Your browser doesn't support the video tag and/or the video formats in use here – sorry!
Usage
Output
Your browser doesn't support the video tag and/or the video formats in use here – sorry!
It's Over 9000!!
Image
The image shortcode returns a <picture> tag with multiple sources.
Each string in the sources array should be a path to an image file of a different type (avif, webp, png, jpg, etc).
The last image in the sources array is used to create an <img> tag for the browser to fall back on if the other formats are not yet supported.
sourcesis an array of image file paths. (mandatory)classsets a class for the image.captionsets the caption text below the image.wsets the width of the image.hsets the height of the image.
sources can be same path, relative path, or root path, like the img shortcode
Optional Classes:
cican be used to center the image.frcan be used to float the image right.flcan be used to float the image left.b1can be used to add a 1px border.
Usage
Output
GIF
The gif shortcode is exactly the same as the video shortcode.
The only difference is it automatically has the additional properties: autoplay, loop, muted, playsinline.
Using the <video> tag in place of gifs allows for reduced file sizes,
which is especially important in regions where internet is slower or
less reliable.
Usage
Output
Your browser doesn't support the video tag and/or the video formats in use here – sorry!
Audio
The audio shortcode takes a sources array of strings and returns an
<audio> tag. Each string in the sources array should be a path to an
audio file of a different type (ogg, mp3, flac, wav, etc).
The browser will play the first type it supports, so placing them in order of size smallest to largest will use the least bandwidth if that is your goal.
sourcesis an array of file paths. (mandatory)classsets a class for the audio.captionsets the caption text below the audio.autoplaywhen set, autoplays the audio on load.loopwhen set, plays the audio on a loop.mutedwhen set, sets the audio muted initially.
sources can be same path, relative path, or root path, like the img shortcode
Optional Classes:
cican be used to center the image.frcan be used to float the image right.flcan be used to float the image left.b1can be used to add a 1px border.
Usage
Output
Your browser doesn't support the audio tag and/or the audio formats in use here – sorry!
Usage
Output
Your browser doesn't support the audio tag and/or the audio formats in use here – sorry!
It's Over 9000!!