English · 简体中文
A Kite plugin: a video link pasted on a line of its own becomes a player.
https://cdn.example.com/2026/demo.mp4becomes a <video> with controls, and
https://www.bilibili.com/video/BV1xx411c7mD
https://youtu.be/dQw4w9WgXcQbecome the players those sites serve. A file of the site's own is the same idea, pasted the way the attachment panel copies it:
[clip.mp4](clip.mp4)
[clip.mp4](/videos/clip.mp4)Nothing else changes: a link inside a sentence stays a link, and a link inside a code block is left exactly as written.
| Address | Becomes |
|---|---|
…/demo.mp4, …/demo.webm, …/demo.ogg |
a <video> element |
clip.mp4, clips/demo.webm |
a <video>, at a file beside the page |
/videos/demo.mp4 |
a <video>, at a file named from the site's root |
bilibili.com/video/BV…, b23.tv/… |
Bilibili's player, loading="lazy" |
youtube.com/watch?v=…, youtu.be/… |
YouTube's player, on youtube-nocookie.com, loading="lazy" |
An address of the site's own is written into the player exactly as it was pasted, so the browser resolves it against the page; the plugin never guesses where the file is. It is taken only when it ends like a video file, so the relative links of a page are not turned into players.
The player states the kind of file it plays, video/mp4, video/webm or
video/ogg, read from the end of the address. That is what carries a video
behind a CDN or an object store that answers application/octet-stream for
everything it is not sure about: with the kind stated, the file plays even when
the Content-Type it arrives with says nothing.
The same addresses pasted as a picture, , are taken
too: a picture of a video is a broken image otherwise.
Both forms are only taken when they stand alone in a paragraph.
The shortcode needs a template in the site or its theme; a site without one
stops the build at that line. This plugin rewrites the finished HTML instead,
so it works with any theme and needs no markdown.unsafeHTML.
The shortcode is still the better choice when the theme has
layouts/_shortcodes/video.html: it takes poster and caption, which a
pasted address has nowhere to carry. The two can live side by side.
make # plugin.wasm, built with GOOS=wasip1 GOARCH=wasm
make test # the transform, on the host
make zip # the archive a release carries, packed by kite
make tar # the files a package carries, as dist/<id>-<version>.tar.gzmake zip needs a kite binary; from a checkout of Kite it is
make zip KITE=../kite/bin/kite.
Pushing a tag v<version> that matches plugin.yaml publishes that zip as a
release, through .github/workflows/release.yml.
The zip the app center collects is made by kite plugin pack; make tar is
the same files as a tarball, for anything that would rather have one. Both
are reproducible: the same files give the same bytes, so a checksum keeps
meaning something.
Needs Go 1.27.4 or newer, the same floor as Kite itself: the module is built
with the patched toolchain, and //go:wasmexport needs 1.24 or newer.
In a site:
mkdir -p plugins && cp -r ../kite-plugin-video plugins/videothen in kite.yaml:
plugins:
enabled: [video]kite plugin verify plugins/video checks it the way a build does.
Once kite-plus/apps lists it, a site installs it by name:
kite plugin add videoor from the studio's 系统 → 应用中心, which shows the icon, the license and what the plugin adds before it is installed.
What the index points at is a release of this repository: a tag v<version>
with <id>-<version>.zip attached, packed by kite plugin pack. That archive
carries plugin.yaml, plugin.wasm, assets/, i18n/, LICENSE and the
READMEs, and nothing else.
A bare filename reaches a file only when the file sits in the item's own
folder, which is where the attachment panel puts it: a page bundle publishes
its files beside its page. An item kept as a single .md file, and a file
uploaded for the site as a whole, are kept in static/uploads and published
at /uploads/, which a bare filename does not reach from /posts/…/; name
those as /uploads/<name>.
A plugin cannot upload a file or raise Kite's 32 MB upload limit. A video too large for the repository belongs on a CDN or an object storage bucket, with the address pasted into the post; that is what this plugin is for.
kite plugin verify reports loads: [] for this plugin, and that number is
about the code it injects: one stylesheet of its own. What it writes into a
page is not injection, but it is not nothing either: a Bilibili or YouTube
address becomes an iframe that the reader's browser loads from those two
sites. A site that may not call out to either should keep its own files on the
video shortcode and leave those addresses as links.