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.6 to 1.0.7

127

index.js

@@ -25,123 +25,2 @@ 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
let content = tokenContent.content;
// clear
tokenContent.content = '';
tokenContent.children = [];
// for safe
content = JSON.stringify(JSON.parse(content), null, 2);
// element
const id = `aplayer-${(new Date()).getTime()}${idx}`;
// opening tag
return `<p><div id="${id}">
<script type="text/javascript">
function __aplayerLoadScript(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);
}
function __aplayerLoadLink(src, callback) {
if (!(typeof callback === 'function')) {
callback = function() {};
}
var check = document.querySelectorAll("link[href='" + src + "']");
if (check.length > 0) {
callback();
return;
}
var link = document.createElement('link');
var head = document.getElementsByTagName('head')[0];
link.rel = 'stylesheet';
link.href = src;
if (link.addEventListener) {
link.addEventListener('load', function () {
callback();
}, false);
} else if (link.attachEvent) {
link.attachEvent('onreadystatechange', function () {
var target = window.event.srcElement;
if (target.readyState === 'loaded') {
callback();
}
});
}
head.appendChild(link);
}
function __aplayerLoadResource(callback){
if(window.APlayer) return callback();
__aplayerLoadLink('https://cdnjs.cloudflare.com/ajax/libs/aplayer/1.10.1/APlayer.min.css',function(){
__aplayerLoadScript('https://cdnjs.cloudflare.com/ajax/libs/aplayer/1.10.1/APlayer.min.js', function() {
return callback();
})
})
}
function __aplayerLoad(id,options){
// options
if(!options.audio) return;
options.container = document.getElementById(id);
if(options.audio.concat){
for(var i=0;i<options.audio.length;i++){
if(!options.audio[i].cover) options.audio[i].cover='https://cdn.cabloy.com/audio/cover.jpg';
}
}else{
if(!options.audio.cover) options.audio.cover='https://cdn.cabloy.com/audio/cover.jpg';
}
// queue
if(!window.__aplayerLoadQueue){
window.__aplayerLoadQueue=[options];
__aplayerLoadResource(function(){
for(var i=0;i<window.__aplayerLoadQueue.length;i++){
new window.APlayer(window.__aplayerLoadQueue[i]);
}
window.__aplayerLoadQueue=null;
});
}else{
window.__aplayerLoadQueue.push(options);
}
}
__aplayerLoad('${id}',${content});
</script>
`;
}
return '<p><div>\n';
}
// closing tag
return '</div></p>\n';
},
};
module.exports = {

@@ -152,7 +31,9 @@ create(ops) {

.use(markdown_it_container)
.use(markdown_it_container, 'warning')
.use(markdown_it_container, 'alert-success')
.use(markdown_it_container, 'alert-info')
.use(markdown_it_container, 'alert-warning')
.use(markdown_it_container, 'alert-danger')
.use(markdown_it_container, 'hljs-left')
.use(markdown_it_container, 'hljs-center')
.use(markdown_it_container, 'hljs-right')
.use(markdown_it_container, 'audio', audio_opts)
.use(markdown_it_deflist)

@@ -159,0 +40,0 @@ .use(markdown_it_emoji)

2

package.json
{
"name": "@zhennann/markdown",
"version": "1.0.6",
"version": "1.0.7",
"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