Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdown-it-html5-embed

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-html5-embed - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

bower.json
{
"name": "markdown-it-html5-embed",
"version": "0.2.0",
"version": "0.3.0",
"homepage": "https://github.com/cmrd-senya/markdown-it-html5-embed",

@@ -5,0 +5,0 @@ "authors": [

@@ -27,2 +27,3 @@ /*! markdown-it-html5-embed https://github.com/cmrd-senya/markdown-it-html5-embed @license MIT */

var isLink;
var title;
var aIndex = token.attrIndex('src');

@@ -32,2 +33,5 @@ if(aIndex < 0) {

isLink = true;
title = tokens[idx+1].content;
} else {
title = token.attrs[token.attrIndex('alt')][1];
}

@@ -49,2 +53,5 @@ // console.log('aindex of idx' + idx);

}
if(!title) {
title = "untitled " + media_type;
}
if(typeof options.html5embed.attributes === "undefined"){

@@ -56,4 +63,19 @@ options.html5embed.attributes = {};

}
if(options.html5embed.templateName) {
if(!HandlebarsTemplates) {
console.log("handlebars_assets is not on the assets pipeline; fall back to the usual mode");
} else {
return HandlebarsTemplates[options.html5embed.templateName]({
media_type: media_type,
attributes: options.html5embed.attributes[media_type],
mimetype: mimetype,
source_url: token.attrs[aIndex][1],
title: title,
needs_cover: media_type==="video"
});
}
}
return ['<' + media_type +' ' + options.html5embed.attributes[media_type] + '>',
'<source type="' + mimetype + '" src=' + token.attrs[aIndex][1] + '></source>',
title,
'</' + media_type + '>'

@@ -60,0 +82,0 @@ ].join('\n');

{
"name": "markdown-it-html5-embed",
"version": "0.2.0",
"version": "0.3.0",
"description": "This is a plugin for markdown-it which adds support for embedding audio/video in the HTML5 way using image embedding syntax ![](url). This is done by replacing standard image renderer of markdown-it.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -70,4 +70,8 @@ # markdown-it-html5-embed

####templateName
String. If the plugin is used in a Rails asset pipeline along with the handlebars_assets gem, then you can use a Handlebars template to control the output of the plugin. This option specifies the name of the template to use, which will be picked from the HandlebarsTemplates array.
## Credits
Based on [the code](http://talk.commonmark.org/t/embedded-audio-and-video/441/16) written by @v3ss0n.

@@ -7,2 +7,3 @@ Video with image syntax:

<source type="video/webm" src=https://example.com/file.webm></source>
untitled video
</video></p>

@@ -17,2 +18,3 @@ .

<source type="audio/ogg" src=https://example.com/file.ogg></source>
untitled audio
</audio></p>

@@ -19,0 +21,0 @@ .

@@ -7,2 +7,3 @@ Video with link syntax:

<source type="video/webm" src=https://example.com/file.webm></source>
test link
</video></p>

@@ -17,2 +18,3 @@ .

<source type="video/webm" src=https://example.com/file.webm></source>
untitled video
</video></p>

@@ -19,0 +21,0 @@ .

@@ -14,2 +14,3 @@ Webm is not allowed:

<source type="audio/mpeg" src=https://example.com/file.mp3></source>
untitled audio
</audio></p>

@@ -24,2 +25,3 @@ .

<source type="video/ogg" src=https://example.com/file.ogv></source>
test link
</video></p>

@@ -26,0 +28,0 @@ .

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc