定制 gcdinsmore/markdown-it-youtube-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gcdinsmore/markdown-it-youtube-php

Composer 安装命令:

composer require gcdinsmore/markdown-it-youtube-php

包简介

YouTube Markdown plugin for markdown-it-php

README 文档

README

This is a plugin for the markdown-it-php Markdown parser by Kenji Yasuda. It allows you to easily embed YouTube videos into your Markdown enabled website, without allowing HTML.

Table of Contents

Install

composer:

composer require gcdinsmore/markdown-it-youtube-php

Simple

use Kaoken\MarkdownIt\MarkdownIt;
use GCDinsmore\YoutubeIt\YoutubeIt;

$md = new MarkdownIt();
$md->plugin(new YoutubeIt());
echo $md->render("!yt[](sk2pr4XD_kw)");

Init with options

$md = new MarkdownIt();
$md->plugin(new YoutubeIt([
	"width" => "200px",
	"height" => "200px",
	"origin" => "https://example.com"
]));
echo $md->render("!yt[](sk2pr4XD_kw)");

Details of the options

Option Default Description
class Specify a class attribute for the iframe. Use this to style iframes.
height 480px The height attribute of the YouTube iframe
origin This is the origin argument of the embedded URL. According to YouTube, this can help prevent malicious JavaScript from hijacking your YouTube videos.
width 270px The width attribute of the YouTube iframe

Syntax

YoutubeIt syntax is similar to the standard image Markdown syntax, except you add yt after the initial exclamation point. The text inside the square brackets is used as the alt text. The optional text after the URL is used as the title.

The URL portion can be just the video ID, or it can be the URL from the YouTube page.

!yt[Lady Washington](https://www.youtube.com/watch?v=4YBB1VXg_hk "Lady Washington from SailingNW.com")

The reference style syntax is supported as well.

!yt[S/V Audrey II][1]
Some text
- a
- b


[1]: sk2pr4XD_kw \"S/V Audrey II Adventure\"

License

I'm using the same MIT license that markdown-it and markdown-it-php are using.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固