magicpen-prism
Advanced tools
Comparing version 3.0.2 to 4.0.0
@@ -75,11 +75,3 @@ var oldPrismGlobal = global.Prism; | ||
installInto: function(magicPen) { | ||
Object.keys(defaultTheme).forEach(function(styleName) { | ||
var style = defaultTheme[styleName]; | ||
while (typeof style === 'string' && style in defaultTheme) { | ||
style = defaultTheme[style]; | ||
} | ||
magicPen.addStyle(styleName, function(text) { | ||
this.text(text, style); | ||
}); | ||
}); | ||
magicPen.installTheme(defaultTheme); | ||
@@ -86,0 +78,0 @@ magicPen.addStyle( |
@@ -77,11 +77,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.magicPenPrism = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
installInto: function(magicPen) { | ||
Object.keys(defaultTheme).forEach(function(styleName) { | ||
var style = defaultTheme[styleName]; | ||
while (typeof style === 'string' && style in defaultTheme) { | ||
style = defaultTheme[style]; | ||
} | ||
magicPen.addStyle(styleName, function(text) { | ||
this.text(text, style); | ||
}); | ||
}); | ||
magicPen.installTheme(defaultTheme); | ||
@@ -388,5 +380,5 @@ magicPen.addStyle( | ||
_.hooks.run("before-highlightall", env); | ||
_.hooks.run('before-highlightall', env); | ||
var elements = env.elements || container.querySelectorAll(env.selector); | ||
var elements = container.querySelectorAll(env.selector); | ||
@@ -400,3 +392,3 @@ for (var i=0, element; element = elements[i++];) { | ||
// Find language | ||
var language, grammar, parent = element; | ||
var language = 'none', grammar, parent = element; | ||
@@ -408,3 +400,3 @@ while (parent && !lang.test(parent.className)) { | ||
if (parent) { | ||
language = (parent.className.match(lang) || [,''])[1].toLowerCase(); | ||
language = (parent.className.match(lang) || [,'none'])[1].toLowerCase(); | ||
grammar = _.languages[language]; | ||
@@ -672,3 +664,3 @@ } | ||
Token.stringify = function(o, language, parent) { | ||
Token.stringify = function(o, language) { | ||
if (typeof o == 'string') { | ||
@@ -680,3 +672,3 @@ return o; | ||
return o.map(function(element) { | ||
return Token.stringify(element, language, o); | ||
return Token.stringify(element, language); | ||
}).join(''); | ||
@@ -687,8 +679,7 @@ } | ||
type: o.type, | ||
content: Token.stringify(o.content, language, parent), | ||
content: Token.stringify(o.content, language), | ||
tag: 'span', | ||
classes: ['token', o.type], | ||
attributes: {}, | ||
language: language, | ||
parent: parent | ||
language: language | ||
}; | ||
@@ -708,3 +699,2 @@ | ||
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>'; | ||
}; | ||
@@ -887,3 +877,3 @@ | ||
'atrule': { | ||
pattern: /@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i, | ||
pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/, | ||
inside: { | ||
@@ -894,3 +884,9 @@ 'rule': /@[\w-]+/ | ||
}, | ||
'url': RegExp('url\\((?:' + string.source + '|.*?)\\)', 'i'), | ||
'url': { | ||
pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'), | ||
inside: { | ||
'function': /^url/i, | ||
'punctuation': /^\(|\)$/ | ||
} | ||
}, | ||
'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'), | ||
@@ -993,13 +989,13 @@ 'string': { | ||
], | ||
'number': /\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, | ||
'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/, | ||
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) | ||
'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/, | ||
'function': /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/, | ||
'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ | ||
}); | ||
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/ | ||
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/; | ||
Prism.languages.insertBefore('javascript', 'keyword', { | ||
'regex': { | ||
pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, | ||
pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/, | ||
lookbehind: true, | ||
@@ -1010,3 +1006,3 @@ greedy: true | ||
'function-variable': { | ||
pattern: /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/, | ||
pattern: /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/, | ||
alias: 'function' | ||
@@ -1040,7 +1036,12 @@ }, | ||
'template-string': { | ||
pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, | ||
pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/, | ||
greedy: true, | ||
inside: { | ||
'template-punctuation': { | ||
pattern: /^`|`$/, | ||
alias: 'string' | ||
}, | ||
'interpolation': { | ||
pattern: /\${[^}]+}/, | ||
pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/, | ||
lookbehind: true, | ||
inside: { | ||
@@ -1180,3 +1181,3 @@ 'interpolation-punctuation': { | ||
"name": "magicpen-prism", | ||
"version": "3.0.2", | ||
"version": "4.0.0", | ||
"description": "Add syntax highlighting support to magicpen via prism.js", | ||
@@ -1201,7 +1202,7 @@ "repository": { | ||
"eslint-plugin-standard": "^4.0.0", | ||
"magicpen": "^6.0.2", | ||
"magicpen": "^6.2.1", | ||
"mocha": "^6.0.2", | ||
"nyc": "^13.3.0", | ||
"prettier": "^1.16.4", | ||
"unexpected": "^11.2.0" | ||
"prettier": "~1.19.1", | ||
"unexpected": "^11.12.1" | ||
}, | ||
@@ -1208,0 +1209,0 @@ "files": [ |
{ | ||
"name": "magicpen-prism", | ||
"version": "3.0.2", | ||
"version": "4.0.0", | ||
"description": "Add syntax highlighting support to magicpen via prism.js", | ||
@@ -23,7 +23,7 @@ "repository": { | ||
"eslint-plugin-standard": "^4.0.0", | ||
"magicpen": "^6.0.2", | ||
"magicpen": "^6.2.1", | ||
"mocha": "^6.0.2", | ||
"nyc": "^13.3.0", | ||
"prettier": "^1.16.4", | ||
"unexpected": "^11.2.0" | ||
"prettier": "~1.19.1", | ||
"unexpected": "^11.12.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "files": [ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
37965
1145