Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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:


```