Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zoonru/commonmark-ext-youtube-iframe
Extension for league/commonmark to replace youtube link with iframe.
https://github.com/zoonru/commonmark-ext-youtube-iframe
commonmark extension iframe markdown youtube
Last synced: 19 days ago
JSON representation
Extension for league/commonmark to replace youtube link with iframe.
- Host: GitHub
- URL: https://github.com/zoonru/commonmark-ext-youtube-iframe
- Owner: zoonru
- License: mit
- Created: 2019-12-12T13:24:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-20T11:12:35.000Z (over 2 years ago)
- Last Synced: 2024-10-21T05:06:52.356Z (27 days ago)
- Topics: commonmark, extension, iframe, markdown, youtube
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 12
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YouTube iframe extension
Extension for [league/commonmark](https://github.com/thephpleague/commonmark) to replace youtube link with iframe.
## Install
``` bash
composer require zoon/commonmark-ext-youtube-iframe
```## Test
```
./vendor/bin/phpunit
```## Example
``` php
use League\CommonMark\CommonMarkConverter;
use Zoon\CommonMark\Ext\YouTubeIframe\YouTubeIframeExtension;$converter = new CommonMarkConverter([
'youtube_iframe' => [
'width' => '600',
'height' => '300',
'allow_full_screen' => true,
],
]);$converter->getEnvironment()->addExtension(new YouTubeIframeExtension());
echo $converter->convert('Check this: [](https://youtu.be/mVnSpPMgoWM?t=10)')->getContent();
echo $converter->convert('Check this: [](https://www.youtube.com/watch?v=mVnSpPMgoWM&t=10)')->getContent();
`````` bash
Check this:
Check this:
```