UNPKG

@diplodoc/transform

Version:

A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML

32 lines (30 loc) 1.31 kB
import type {VideoUrlFn} from './types'; export const videoUrl: VideoUrlFn = (service, videoID, options) => { switch (service) { case 'youtube': return `https://www.youtube.com/embed/${videoID}`; case 'vimeo': return `https://player.vimeo.com/video/${videoID}`; case 'vine': return `https://vine.co/v/${videoID}/embed/${options.vine.embed}`; case 'prezi': return ( `https://prezi.com/embed/${videoID}` + '/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0&' + 'landing_data=bHVZZmNaNDBIWnNjdEVENDRhZDFNZGNIUE43MHdLNWpsdFJLb2ZHanI5N1lQVHkxSHFxazZ0UUNCRHloSXZROHh3PT0&' + 'landing_sign=1kD6c0N6aYpMUS0wxnQjxzSqZlEB8qNFdxtdjYhwSuI' ); case 'osf': return `https://mfr.osf.io/render?url=https://osf.io/${videoID}/?action=download`; case 'yandex': return `https://runtime.video.cloud.yandex.net/player/video/${videoID}`; case 'vk': return `https://vk.com/video_ext.php?${videoID}`; case 'rutube': return `https://rutube.ru/play/embed/${videoID}`; case 'url': return videoID; default: return service; } };