mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
added a vimeo extension that embeds a video
This commit is contained in:
parent
2e102c72b2
commit
2c4b2ca558
19
src/extensions/vimeo.js
Normal file
19
src/extensions/vimeo.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// vimeo Extension
|
||||||
|
// changes http://vimeo.com/12345678
|
||||||
|
// into an embedded iframe
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
var vimeoTemplate = ['<iframe sandbox="allow-same-origin allow-scripts allow-popups" id="foo" width="100%" height="90%" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" src="http://player.vimeo.com/video/','?api=1"> </iframe>'];
|
||||||
|
var vimeo = function(converter) {
|
||||||
|
return [
|
||||||
|
{ type: 'lang', regex: 'http:\/\/(www\.)?vimeo.com\/(\\\d{8})', replace: vimeoTemplate[0]+"$2"+vimeoTemplate[1] }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client-side export
|
||||||
|
if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.vimeo = vimeo; }
|
||||||
|
// Server-side export
|
||||||
|
if (typeof module !== 'undefined') module.exports = vimeo;
|
||||||
|
|
||||||
|
}());
|
Loading…
Reference in New Issue
Block a user