Plugins Embeds

pictures, video and diagrams @mdsvex/plugin-embeds@0.1.1

Embeds

Video embeds: YouTube and Vimeo players named by their title

Install

pnpm add -D @mdsvex/plugin-embeds

Turn it on

import { embeds } from '@mdsvex/plugin-embeds';

mdsvex({ plugins: [embeds()] });

What it reads

::youtube[Title](id=…) ::vimeo[Title](id=…)

owns youtube, vimeo

An example

You write
::vimeo[The New Vimeo Player](id=76979871)

You get
Build-time preview.

::youtube[Title](id=...) is a lazy YouTube player from youtube-nocookie.com, which sets no cookie until the video plays, and ::vimeo[Title](id=...) a lazy Vimeo player with dnt=1. start is a time in seconds. The bracket text is the title of the frame, which is what a screen reader announces, and (title=...) sets it instead. The build warns about an embed with no id or one that is no id on its site (embed_id), and one with no title (embed_without_title). embeds({ css: false }) leaves the stylesheet out, and a youtube or vimeo from a directives module replaces the plugin's component.

Options, from its types 1

css?: boolean
False leaves the default stylesheet out, the markup and its class names stay the same

Components @mdsvex/plugin-embeds/YouTube.svelte, @mdsvex/plugin-embeds/Vimeo.svelte

Stylesheet @mdsvex/plugin-embeds/embeds.css, or embeds({ css: false }) for none

Find another plugin · Write your own

mdsvex, markdown with Svelte in it. MIT licence.