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

@zhennann/markdown

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zhennann/markdown - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

64

index.js

@@ -25,2 +25,65 @@ const markdown_it = require('markdown-it');

const audio_opts = {
validate(params) {
return params.trim().match(/^audio$/);
},
render(tokens, idx) {
if (tokens[idx].nesting === 1) {
const tokenContent = tokens[idx + 2];
if (tokenContent && tokenContent.type === 'inline') {
// content
const content = tokenContent.content;
tokenContent.content = '';
tokenContent.children = [];
// element
const id = `skPlayer-${(new Date()).getTime()}`;
// opening tag
return `<div id="${id}" class="skPlayer">
<script type="text/javascript">
function loadScript(src, callback) {
if (!(typeof callback === 'function')) {
callback = function() {};
}
var check = document.querySelectorAll("script[src='" + src + "']");
if (check.length > 0) {
check[0].addEventListener('load', function() {
callback();
});
callback();
return;
}
var script = document.createElement('script');
var head = document.getElementsByTagName('head')[0];
script.type = 'text/javascript';
script.charset = 'UTF-8';
script.src = src;
if (script.addEventListener) {
script.addEventListener('load', function() {
callback();
}, false);
} else if (script.attachEvent) {
script.attachEvent('onreadystatechange', function() {
var target = window.event.srcElement;
if (target.readyState === 'loaded') {
callback();
}
});
}
head.appendChild(script);
}
loadScript('https://cdn.cabloy.org/audio/skPlayer.min.js', function() {
var options = ${content};
options.element = document.getElementById('${id}');
var player = new skPlayer(options);
})
</script>
`;
}
return '<div>\n';
}
// closing tag
return '</div>\n';
},
};
module.exports = {

@@ -35,2 +98,3 @@ create(ops) {

.use(markdown_it_container, 'hljs-right')
.use(markdown_it_container, 'audio', audio_opts)
.use(markdown_it_deflist)

@@ -37,0 +101,0 @@ .use(markdown_it_emoji)

2

package.json
{
"name": "@zhennann/markdown",
"version": "1.0.0",
"version": "1.0.1",
"description": "markdown",

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

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