Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
gridsome-remark-plugin-youtube
Advanced tools
This is a plugin for Gridsome's chosen markdown engine, Remark, and allows you to embed YouTube videos in markdown files.
npm i gridsome-plugin-remark-youtube
# yarn add gridsome-plugin-remark-youtube
module.exports = {
plugins: [
{
use: '@gridsome/source-filesystem',
options: {
path: 'blog/**/*.md',
route: '/blog/:year/:month/:day/:slug',
remark: {
plugins: [
['gridsome-plugin-remark-youtube']
]
}
}
}
]
}
There are options to change width of the video, and whether the video is left aligned or centred:
100%
. Set to any valid CSS width.0
. The default left aligns the video. Set to auto
to align the video centrally.Loading with options:
module.exports = {
plugins: [
{
use: '@gridsome/source-filesystem',
options: {
path: 'blog/**/*.md',
route: '/blog/:year/:month/:day/:slug',
remark: {
plugins: [
['gridsome-plugin-remark-youtube', {width: '500px', align: 'auto'}]
]
}
}
}
]
}
This plugin uses the same markdown syntax as the Gatsby plugin, with backticks (`) and a youtube:
prefix, followed by the YouTube URL. Any valid YouTube URL should work.
`youtube:https://www.youtube.com/watch?v=dQw4w9WgXcQ`
or
`youtube:https://www.youtube.com/embed/dQw4w9WgXcQ`
or
`youtube:https://youtu.be/dQw4w9WgXcQ`
This is how the video should appear on the screen:
This is the HTML that is being generated by the plugin and injected into the page:
<div style="width: 100%; margin: 0 auto;"><div style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;"><iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/dQw4w9WgXcQ"></iframe></div></div>
MIT
Some of the code in this plugin was copied from the Gatsby plugin for embedding YouTube videos in markdown:
https://github.com/ntwcklng/gatsby-remark-embed-youtube
To figure out how to convert the above plugin to a Gridsome plugin, I cribbed from Gridsome's Twitter Remark plugin:
FAQs
Gridsome Remark plugin to embed YouTube videos
The npm package gridsome-remark-plugin-youtube receives a total of 1 weekly downloads. As such, gridsome-remark-plugin-youtube popularity was classified as not popular.
We found that gridsome-remark-plugin-youtube demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.