npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qinqing3761/markdown-it-video

v1.1.0

Published

Markdown-it plugin to embed a hosted videos

Downloads

6

Readme

markdown-it-video

markdown-it plugin for embedding hosted videos.

Build Status

Usage

Enable plugin

  var md = require('markdown-it')({
    html: true,
    linkify: true,
    typography: true
  }).use(require('markdown-it-video'), // <-- this use(package_name) is required 
  {
    youtube: { width: 640, height: 390 },
    vimeo: { width: 500, height: 281 },
    vine: { width: 600, height: 600, embed: 'simple' },
    prezi: { width: 550, height: 400 }
  })

Inline style

This plugin is made to work in the inline style. If you'd like a block-style, you may be interested in https://github.com/rotorz/markdown-it-block-embed

YouTube

@[youtube](dQw4w9WgXcQ)

is interpreted as

<p><div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" id="youtubeplayer" type="text/html" width="640" height="390"
  src="//www.youtube.com/embed/dQw4w9WgXcQ"
  frameborder="0"/></div></p>

Alternately, you could use a number of different YouTube URL formats rather than just the video id.

@[youtube](http://www.youtube.com/embed/dQw4w9WgXcQ)
@[youtube](https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=feedrec_centerforopenscience_index)
@[youtube](http://www.youtube.com/user/IngridMichaelsonVEVO#p/a/u/1/QdK8U-VIH_o)
@[youtube](http://www.youtube.com/v/dQw4w9WgXcQ?fs=1&amp;hl=en_US&amp;rel=0)
@[youtube](http://www.youtube.com/watch?v=dQw4w9WgXcQ#t=0m10s)
@[youtube](http://www.youtube.com/embed/dQw4w9WgXcQ?rel=0)
@[youtube](http://www.youtube.com/watch?v=dQw4w9WgXcQ)
@[youtube](http://youtu.be/dQw4w9WgXcQ)
@[youtube](dQw4w9WgXcQ?rel=0)

Vimeo

@[vimeo](19706846)

is interpreted as

<p><div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" id="vimeoplayer" type="text/html" width="500" height="281"
  src="//player.vimeo.com/video/19706846"
  frameborder="0"/></div></p>

Alternately, you could use the url instead of just the video id.

@[vimeo](https://vimeo.com/19706846)
@[vimeo](https://player.vimeo.com/video/19706846)

Vine

@[vine](etVpwB7uHlw)

is interpreted as

<p><div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" id="vineplayer" type="text/html" width="600" height="600"
  src="//vine.co/v/etVpwB7uHlw/embed/simple"
  frameborder="0"/></div></p>

Alternately, you could use the url, or even the whole embed tag instead of just the video id.

@[vine](https://vine.co/v/etVpwB7uHlw/embed/simple)
@[vine](https://vine.co/v/etVpwB7uHlw/embed/postcard?audio=1)
@[vine](<iframe src="https://vine.co/v/etVpwB7uHlw/embed/simple?audio=1" width="600" height="600" frameborder="0"></iframe><script src="https://platform.vine.co/static/scripts/embed.js"></script>)

Prezi

@[prezi](1kkxdtlp4241)

is interpreted as

<p><div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" id="preziplayer" type="text/html" width="550" height="400" src="https://prezi.com/embed/1kkxdtlp4241/?bgcolor=ffffff&amp;lock_to_path=0&amp;autoplay=0&amp;autohide_ctrls=0&amp;landing_data=bHVZZmNaNDBIWnNjdEVENDRhZDFNZGNIUE43MHdLNWpsdFJLb2ZHanI5N1lQVHkxSHFxazZ0UUNCRHloSXZROHh3PT0&amp;landing_sign=1kD6c0N6aYpMUS0wxnQjxzSqZlEB8qNFdxtdjYhwSuI" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div></p>

Alternately, you could use the url.

@[prezi](https://prezi.com/1kkxdtlp4241/valentines-day/)
@[prezi](https://prezi.com/e3g83t83nw03/destination-prezi-template/)
@[prezi](https://prezi.com/prg6t46qgzik/anatomy-of-a-social-powered-customer-service-win/)

OSF

This plugin allows you to use the OSF's Modualar File Renderer or the MFR to embed video or other files into your markdown assuming your page has mfr.js and mfr.css loaded.

@[osf](kuvg9)

is interpreted as

<p><div id="randomid" class="mfr mfr-file"></div><script>$(document).ready(function () {new mfr.Render("randomid", "https://mfr.osf.io/render?url=https://osf.io/kuvg9/?action=download%26mode=render");    }); </script></p>

Alternately, you could use the url.

@[osf](https://mfr.osf.io/render?url=https://osf.io/kuvg9/?action=download)

TCPlayer

腾讯云超级播放器官方使用文档:https://cloud.tencent.com/document/product/266/14424。 假设你的页面已经加载了tcplayer.min.js、hls.min.js和tcplayer.css,这个插件允许你使用TCPlayer嵌入视频,具体版本可参阅官方使用文档。

@[tcplay](fileID=622828&appID=28192)

is interpreted as

<p><video id="2ayrktm5q4" preload="auto" playsinline webkit-playsinline x5-playsinline class="tcplay-file"></video><script>window.onload = function () {new TCPlayer("2ayrktm5q4", { fileID: "622828", appID: "28192", width: "640", height: "390", autoplay: false})}; </script></p>

HTML5 Video

支持普通的视频链接,如 https://xxx/movie.mp4,必须以 http或https开头,以常用的视频扩展名结尾; mp4|flv|ogg|avi|mov|wmv

@[commonlink](https://www.xxx/movie.mp4)

is interpreted as

<p><video width="640" height="390" src="https://www.xxx/movie.mp4" class="common-link-video" controls>您的浏览器不支持 HTML5 video 标签。</video></p>

Options

YouTube

youtube: {
  width: 640,
  height: 390,
  nocookie: false,
  parameters: {}
}
nocookie

Use https://youtube-nocookie.com instead of https://youtube.com for all embeds. This enables 'Privacy Enhanced Mode' as described at the corresponding Google help page

parameters

This option allows to add/overwrite embed parameters globally. Pass an object with parameter/value pairs to change the design and behavior of the YouTube player. For a list of valid parameters please refer to the official documentation.

Example: Start playback at 10 seconds and disable displaying related videos.

{
    rel: 0,
    start: 10
}