Gridsome Remark Video Embeds Plugin
This is a plugin for Gridsome's chosen markdown engine, Remark, and allows you to, currently, embed YouTube and Vimeo videos in markdown files.
Installation
Not currently available on npm, testing/personal use for the moment. See ryland/gridsome-plugin-remark-youtube for a solid working Youtube embed implementation for Gridsome.
Loading
moduleexports = plugins: use: '@gridsome/source-filesystem' options: path: 'blog/**/*.md' route: '/blog/:year/:month/:day/:slug' remark: plugins: 'gridsome-plugin-remark-video-embeds'
Options
There are options to change width of the video, and whether the video is left aligned or centred:
- width Default
100%
. Set to any valid CSS width. - align Default
0
. The default left aligns the video. Set toauto
to align the video centrally.
Loading with options:
moduleexports = plugins: use: '@gridsome/source-filesystem' options: path: 'blog/**/*.md' route: '/blog/:year/:month/:day/:slug' remark: plugins: 'gridsome-plugin-remark-video-embeds' width: '500px' align: 'auto'
Usage
This plugin borrows the syntax used in the Gatsby Instagram Embed plugin, and my in-progress instagram embed plugin (paused due to Facebook) of using Markdown image alt tags ![youtube](video-id)
to embed posts.
`![youtube](dQw4w9WgXcQ)` Vimeo `![vimeo](dQw4w9WgXcQ)`
Output
Video
This is how the video should appear on the screen:
Generated HTML
This is the HTML that is being generated by the plugin and injected into the page:
License
MIT
Credit
This plugin is a combination of the Gatsby Instagram embed syntax and Gridsome Remark Youtube plugin for handling the Gridsome specific implementation.