Skip to content

Commit e9771da

Browse files
committed
markdown: add video support for vimeo
1 parent ad2f08e commit e9771da

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/markdown/fan/ext/xetodoc/Xetodoc.fan

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ internal class VideoRenderer : NodeRenderer
224224
private static const [Str:Str] stdAttrs := [
225225
"frameborder": "0",
226226
"allowfullscreen": "true",
227-
"width": "50%",
228-
"height": "35%",
227+
"width": "960",
228+
"height": "540",
229229
]
230230

231231
override Void render(Node node)
@@ -234,8 +234,10 @@ internal class VideoRenderer : NodeRenderer
234234
type := video.uri.host.lower
235235
switch (type)
236236
{
237-
case "loom": renderLoom(video)
238-
// case "vimeo": renderVimeo(embed)
237+
case "loom":
238+
renderLoom(video)
239+
case "vimeo":
240+
renderVimeo(video)
239241
case "youtube":
240242
case "youtu.be":
241243
renderYoutube(video)
@@ -256,6 +258,19 @@ internal class VideoRenderer : NodeRenderer
256258
renderVideo(attrs)
257259
}
258260

261+
private Void renderVimeo(Video video)
262+
{
263+
uri := video.uri
264+
src := `https://player.vimeo.com/video/${uri.name}`
265+
attrs := stdAttrs.dup.addAll([
266+
"title": "${video.altText}",
267+
"portrait": "0",
268+
"byline":"0",
269+
"src": src.toStr,
270+
]).setAll(uri.query)
271+
renderVideo(attrs)
272+
}
273+
259274
private Void renderYoutube(Video video)
260275
{
261276
uri := video.uri

0 commit comments

Comments
 (0)