Comparing version 1.8.1 to 1.9.0
@@ -1,1 +0,1 @@ | ||
{"languages":["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","cpp","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","crmsh","crystal","cs","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nimrod","nix","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","tex","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"],"aliases":{"1c":"1c","abnf":"abnf","accesslog":"accesslog","actionscript":"actionscript","as":"actionscript","ada":"ada","angelscript":"angelscript","asc":"angelscript","apache":"apache","apacheconf":"apache","applescript":"applescript","osascript":"applescript","arcade":"arcade","cpp":"cpp","c":"arduino","cc":"arduino","h":"arduino","c++":"arduino","h++":"arduino","hpp":"arduino","hh":"arduino","hxx":"arduino","cxx":"arduino","arduino":"arduino","armasm":"armasm","arm":"armasm","xml":"xml","html":"xml","xhtml":"xml","rss":"xml","atom":"xml","xjb":"xml","xsd":"xml","xsl":"xml","plist":"xml","wsf":"xml","svg":"xml","asciidoc":"asciidoc","adoc":"asciidoc","aspectj":"aspectj","autohotkey":"autohotkey","ahk":"autohotkey","autoit":"autoit","avrasm":"avrasm","awk":"awk","axapta":"axapta","bash":"bash","sh":"bash","zsh":"bash","basic":"basic","bnf":"bnf","brainfuck":"brainfuck","bf":"brainfuck","cal":"cal","capnproto":"capnproto","capnp":"capnproto","ceylon":"ceylon","clean":"clean","icl":"clean","dcl":"clean","clojure":"clojure","clj":"clojure","clojure-repl":"clojure-repl","cmake":"cmake","cmake.in":"cmake","coffeescript":"coffeescript","coffee":"coffeescript","cson":"coffeescript","iced":"coffeescript","coq":"coq","cos":"cos","cls":"cos","crmsh":"crmsh","crm":"crmsh","pcmk":"crmsh","crystal":"crystal","cr":"crystal","cs":"cs","csharp":"cs","c#":"cs","csp":"csp","css":"css","d":"d","markdown":"markdown","md":"markdown","mkdown":"markdown","mkd":"markdown","dart":"dart","delphi":"delphi","dpr":"delphi","dfm":"delphi","pas":"delphi","pascal":"delphi","freepascal":"delphi","lazarus":"delphi","lpr":"delphi","lfm":"delphi","diff":"diff","patch":"diff","django":"django","jinja":"django","dns":"dns","bind":"dns","zone":"dns","dockerfile":"dockerfile","docker":"dockerfile","dos":"dos","bat":"dos","cmd":"dos","dsconfig":"dsconfig","dts":"dts","dust":"dust","dst":"dust","ebnf":"ebnf","elixir":"elixir","elm":"elm","ruby":"ruby","rb":"ruby","gemspec":"ruby","podspec":"ruby","thor":"ruby","irb":"ruby","erb":"erb","erlang-repl":"erlang-repl","erlang":"erlang","erl":"erlang","excel":"excel","xlsx":"excel","xls":"excel","fix":"fix","flix":"flix","fortran":"fortran","f90":"fortran","f95":"fortran","fsharp":"fsharp","fs":"fsharp","gams":"gams","gms":"gams","gauss":"gauss","gss":"gauss","gcode":"gcode","nc":"gcode","gherkin":"gherkin","feature":"gherkin","glsl":"glsl","gml":"gml","GML":"gml","go":"go","golang":"go","golo":"golo","gradle":"gradle","groovy":"groovy","haml":"haml","handlebars":"handlebars","hbs":"handlebars","html.hbs":"handlebars","html.handlebars":"handlebars","haskell":"haskell","hs":"haskell","haxe":"haxe","hx":"haxe","hsp":"hsp","htmlbars":"htmlbars","http":"http","https":"http","hy":"hy","hylang":"hy","inform7":"inform7","i7":"inform7","ini":"ini","toml":"ini","irpf90":"irpf90","isbl":"isbl","java":"java","jsp":"java","javascript":"javascript","js":"javascript","jsx":"javascript","mjs":"javascript","cjs":"javascript","jboss-cli":"jboss-cli","wildfly-cli":"jboss-cli","json":"json","julia":"julia","julia-repl":"julia-repl","kotlin":"kotlin","kt":"kotlin","lasso":"lasso","ls":"livescript","lassoscript":"lasso","ldif":"ldif","leaf":"leaf","less":"less","lisp":"lisp","livecodeserver":"livecodeserver","livescript":"livescript","llvm":"llvm","lsl":"lsl","lua":"lua","makefile":"makefile","mk":"makefile","mak":"makefile","mathematica":"mathematica","mma":"mathematica","wl":"mathematica","matlab":"matlab","maxima":"maxima","mel":"mel","mercury":"mercury","m":"mercury","moo":"mercury","mipsasm":"mipsasm","mips":"mipsasm","mizar":"mizar","perl":"perl","pl":"perl","pm":"perl","mojolicious":"mojolicious","monkey":"monkey","moonscript":"moonscript","moon":"moonscript","n1ql":"n1ql","nginx":"nginx","nginxconf":"nginx","nimrod":"nimrod","nim":"nimrod","nix":"nix","nixos":"nix","nsis":"nsis","objectivec":"objectivec","mm":"objectivec","objc":"objectivec","obj-c":"objectivec","ocaml":"ocaml","ml":"sml","openscad":"openscad","scad":"openscad","oxygene":"oxygene","parser3":"parser3","pf":"pf","pf.conf":"pf","pgsql":"pgsql","postgres":"pgsql","postgresql":"pgsql","php":"php","php3":"php","php4":"php","php5":"php","php6":"php","php7":"php","plaintext":"plaintext","pony":"pony","powershell":"powershell","ps":"powershell","ps1":"powershell","processing":"processing","profile":"profile","prolog":"prolog","properties":"properties","protobuf":"protobuf","puppet":"puppet","pp":"puppet","purebasic":"purebasic","pb":"purebasic","pbi":"purebasic","python":"python","py":"python","gyp":"python","ipython":"python","q":"q","k":"q","kdb":"q","qml":"qml","qt":"qml","r":"r","reasonml":"reasonml","re":"reasonml","rib":"rib","roboconf":"roboconf","graph":"roboconf","instances":"roboconf","routeros":"routeros","mikrotik":"routeros","rsl":"rsl","ruleslanguage":"ruleslanguage","rust":"rust","rs":"rust","sas":"sas","SAS":"sas","scala":"scala","scheme":"scheme","scilab":"scilab","sci":"scilab","scss":"scss","shell":"shell","console":"shell","smali":"smali","smalltalk":"smalltalk","st":"smalltalk","sml":"sml","sqf":"sqf","sql":"sql","stan":"stan","stata":"stata","do":"stata","ado":"stata","step21":"step21","p21":"step21","step":"step21","stp":"step21","stylus":"stylus","styl":"stylus","subunit":"subunit","swift":"swift","taggerscript":"taggerscript","yaml":"yaml","yml":"yaml","YAML":"yaml","tap":"tap","tcl":"tcl","tk":"tcl","tex":"tex","thrift":"thrift","tp":"tp","twig":"twig","craftcms":"twig","typescript":"typescript","ts":"typescript","vala":"vala","vbnet":"vbnet","vb":"vbnet","vbscript":"vbscript","vbs":"vbscript","vbscript-html":"vbscript-html","verilog":"verilog","v":"verilog","sv":"verilog","svh":"verilog","vhdl":"vhdl","vim":"vim","x86asm":"x86asm","xl":"xl","tao":"xl","xquery":"xquery","xpath":"xquery","xq":"xquery","zephir":"zephir","zep":"zephir"}} | ||
{"languages":["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","cpp","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","crmsh","crystal","cs","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nimrod","nix","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","tex","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"],"aliases":{"1c":"1c","abnf":"abnf","accesslog":"accesslog","actionscript":"actionscript","as":"actionscript","ada":"ada","angelscript":"angelscript","asc":"angelscript","apache":"apache","apacheconf":"apache","applescript":"applescript","osascript":"applescript","arcade":"arcade","cpp":"cpp","c":"cpp","cc":"cpp","h":"cpp","c++":"cpp","h++":"cpp","hpp":"cpp","arduino":"arduino","armasm":"armasm","arm":"armasm","xml":"xml","html":"xml","xhtml":"xml","rss":"xml","atom":"xml","xjb":"xml","xsd":"xml","xsl":"xml","plist":"xml","asciidoc":"asciidoc","adoc":"asciidoc","aspectj":"aspectj","autohotkey":"autohotkey","ahk":"autohotkey","autoit":"autoit","avrasm":"avrasm","awk":"awk","axapta":"axapta","bash":"bash","sh":"bash","zsh":"bash","basic":"basic","bnf":"bnf","brainfuck":"brainfuck","bf":"brainfuck","cal":"cal","capnproto":"capnproto","capnp":"capnproto","ceylon":"ceylon","clean":"clean","icl":"clean","dcl":"clean","clojure":"clojure","clj":"clojure","clojure-repl":"clojure-repl","cmake":"cmake","cmake.in":"cmake","coffeescript":"coffeescript","coffee":"coffeescript","cson":"coffeescript","iced":"coffeescript","coq":"coq","cos":"cos","cls":"cos","crmsh":"crmsh","crm":"crmsh","pcmk":"crmsh","crystal":"crystal","cr":"crystal","cs":"cs","csharp":"cs","csp":"csp","css":"css","d":"d","markdown":"markdown","md":"markdown","mkdown":"markdown","mkd":"markdown","dart":"dart","delphi":"delphi","dpr":"delphi","dfm":"delphi","pas":"delphi","pascal":"delphi","freepascal":"delphi","lazarus":"delphi","lpr":"delphi","lfm":"delphi","diff":"diff","patch":"diff","django":"django","jinja":"django","dns":"dns","bind":"dns","zone":"dns","dockerfile":"dockerfile","docker":"dockerfile","dos":"dos","bat":"dos","cmd":"dos","dsconfig":"dsconfig","dts":"dts","dust":"dust","dst":"dust","ebnf":"ebnf","elixir":"elixir","elm":"elm","ruby":"ruby","rb":"ruby","gemspec":"ruby","podspec":"ruby","thor":"ruby","irb":"ruby","erb":"erb","erlang-repl":"erlang-repl","erlang":"erlang","erl":"erlang","excel":"excel","xlsx":"excel","xls":"excel","fix":"fix","flix":"flix","fortran":"fortran","f90":"fortran","f95":"fortran","fsharp":"fsharp","fs":"fsharp","gams":"gams","gms":"gams","gauss":"gauss","gss":"gauss","gcode":"gcode","nc":"gcode","gherkin":"gherkin","feature":"gherkin","glsl":"glsl","gml":"gml","GML":"gml","go":"go","golang":"go","golo":"golo","gradle":"gradle","groovy":"groovy","haml":"haml","handlebars":"handlebars","hbs":"handlebars","html.hbs":"handlebars","html.handlebars":"handlebars","haskell":"haskell","hs":"haskell","haxe":"haxe","hx":"haxe","hsp":"hsp","htmlbars":"htmlbars","http":"http","https":"http","hy":"hy","hylang":"hy","inform7":"inform7","i7":"inform7","ini":"ini","toml":"ini","irpf90":"irpf90","isbl":"isbl","java":"java","jsp":"java","javascript":"javascript","js":"javascript","jsx":"javascript","jboss-cli":"jboss-cli","wildfly-cli":"jboss-cli","json":"json","julia":"julia","julia-repl":"julia-repl","kotlin":"kotlin","kt":"kotlin","lasso":"lasso","ls":"livescript","lassoscript":"lasso","ldif":"ldif","leaf":"leaf","less":"less","lisp":"lisp","livecodeserver":"livecodeserver","livescript":"livescript","llvm":"llvm","lsl":"lsl","lua":"lua","makefile":"makefile","mk":"makefile","mak":"makefile","mathematica":"mathematica","mma":"mathematica","matlab":"matlab","maxima":"maxima","mel":"mel","mercury":"mercury","m":"mercury","moo":"mercury","mipsasm":"mipsasm","mips":"mipsasm","mizar":"mizar","perl":"perl","pl":"perl","pm":"perl","mojolicious":"mojolicious","monkey":"monkey","moonscript":"moonscript","moon":"moonscript","n1ql":"n1ql","nginx":"nginx","nginxconf":"nginx","nimrod":"nimrod","nim":"nimrod","nix":"nix","nixos":"nix","nsis":"nsis","objectivec":"objectivec","mm":"objectivec","objc":"objectivec","obj-c":"objectivec","ocaml":"ocaml","ml":"sml","openscad":"openscad","scad":"openscad","oxygene":"oxygene","parser3":"parser3","pf":"pf","pf.conf":"pf","pgsql":"pgsql","postgres":"pgsql","postgresql":"pgsql","php":"php","php3":"php","php4":"php","php5":"php","php6":"php","php7":"php","plaintext":"plaintext","pony":"pony","powershell":"powershell","ps":"powershell","processing":"processing","profile":"profile","prolog":"prolog","properties":"properties","protobuf":"protobuf","puppet":"puppet","pp":"puppet","purebasic":"purebasic","pb":"purebasic","pbi":"purebasic","python":"python","py":"python","gyp":"python","q":"q","k":"q","kdb":"q","qml":"qml","qt":"qml","r":"r","reasonml":"reasonml","re":"reasonml","rib":"rib","roboconf":"roboconf","graph":"roboconf","instances":"roboconf","routeros":"routeros","mikrotik":"routeros","rsl":"rsl","ruleslanguage":"ruleslanguage","rust":"rust","rs":"rust","sas":"sas","SAS":"sas","scala":"scala","scheme":"scheme","scilab":"scilab","sci":"scilab","scss":"scss","shell":"shell","console":"shell","smali":"smali","smalltalk":"smalltalk","st":"smalltalk","sml":"sml","sqf":"sqf","sql":"sql","stan":"stan","stata":"stata","do":"stata","ado":"stata","step21":"step21","p21":"step21","step":"step21","stp":"step21","stylus":"stylus","styl":"stylus","subunit":"subunit","swift":"swift","taggerscript":"taggerscript","yaml":"yaml","yml":"yaml","YAML":"yaml","tap":"tap","tcl":"tcl","tk":"tcl","tex":"tex","thrift":"thrift","tp":"tp","twig":"twig","craftcms":"twig","typescript":"typescript","ts":"typescript","vala":"vala","vbnet":"vbnet","vb":"vbnet","vbscript":"vbscript","vbs":"vbscript","vbscript-html":"vbscript-html","verilog":"verilog","v":"verilog","sv":"verilog","svh":"verilog","vhdl":"vhdl","vim":"vim","x86asm":"x86asm","xl":"xl","tao":"xl","xquery":"xquery","xpath":"xquery","xq":"xquery","zephir":"zephir","zep":"zephir"}} |
@@ -11,5 +11,2 @@ 'use strict'; | ||
function fullUrlForHelper(path = '/') { | ||
const pathRegex = /^(\/\/|http(s)?:)/; | ||
if (pathRegex.test(path)) return path; | ||
const { config } = this; | ||
@@ -23,2 +20,4 @@ const prettyUrlsOptions = Object.assign({ | ||
return cache.apply(`${config.url}-${prettyUrlsOptions.trailing_index}-${prettyUrlsOptions.trailing_html}-${path}`, () => { | ||
if (/^(\/\/|http(s)?:)/.test(path)) return path; | ||
const sitehost = parse(config.url).hostname || config.url; | ||
@@ -25,0 +24,0 @@ const data = new URL(path, `http://${sitehost}`); |
'use strict'; | ||
const hljs = require('highlight.js'); | ||
const stripIndent = require('strip-indent'); | ||
const alias = require('../highlight_alias.json'); | ||
@@ -9,2 +10,3 @@ const escapeHTML = require('./escape_html'); | ||
if (typeof str !== 'string') throw new TypeError('str must be a string!'); | ||
str = stripIndent(str); | ||
@@ -77,6 +79,2 @@ const useHljs = Object.prototype.hasOwnProperty.call(options, 'hljs') ? options.hljs : false; | ||
function encodePlainString(str) { | ||
return escapeHTML(str); | ||
} | ||
function replaceTabs(str, tab) { | ||
@@ -108,3 +106,3 @@ return str.replace(/^\t+/, match => { | ||
const result = { | ||
value: encodePlainString(str), | ||
value: escapeHTML(str), | ||
language: lang.toLowerCase() | ||
@@ -122,4 +120,2 @@ }; | ||
if (options.hljs) return hljs.highlight(lang, str); | ||
return tryHighlight(str, result.language) || result; | ||
@@ -126,0 +122,0 @@ } |
@@ -28,3 +28,3 @@ 'use strict'; | ||
if (i.match(regexUrl) | ||
|| (tag === 'meta' && !attrs[i].match(regexMeta) && Object.values(attrs)[0].match(regexMeta))) { | ||
|| (tag === 'meta' && !String(attrs[i]).match(regexMeta) && Object.values(attrs)[0].match(regexMeta))) { | ||
result += ` ${escapeHTML(i)}="${encodeURL(attrs[i])}"`; | ||
@@ -31,0 +31,0 @@ } else if (attrs[i] === true || i === attrs[i]) result += ` ${escapeHTML(i)}`; |
@@ -26,2 +26,3 @@ 'use strict'; | ||
exports.prettyUrls = require('./pretty_urls'); | ||
exports.prismHighlight = require('./prism'); | ||
exports.relative_url = require('./relative_url'); | ||
@@ -31,2 +32,3 @@ exports.slugize = require('./slugize'); | ||
exports.stripHTML = require('./strip_html'); | ||
exports.stripIndent = require('./strip_indent'); | ||
exports.tocObj = require('./toc_obj'); | ||
@@ -33,0 +35,0 @@ exports.truncate = require('./truncate'); |
@@ -15,10 +15,19 @@ 'use strict'; | ||
function isExternalLink(input, sitehost, exclude) { | ||
sitehost = parse(sitehost).hostname || sitehost; | ||
return cache.apply(`${input}-${sitehost}-${exclude}`, () => { | ||
// Return false early for internal link | ||
if (!/^(\/\/|http(s)?:)/.test(input)) return false; | ||
if (!sitehost) return false; | ||
sitehost = parse(sitehost).hostname || sitehost; | ||
return cache.apply(`${input}-${sitehost}-${exclude}`, () => { | ||
// handle relative url | ||
const data = new URL(input, `http://${sitehost}`); | ||
if (!sitehost) return false; | ||
// handle relative url and invalid url | ||
let data; | ||
try { | ||
data = new URL(input, `http://${sitehost}`); | ||
} catch (e) { } | ||
// if input is invalid url, data should be undefined | ||
if (typeof data !== 'object') return false; | ||
// handle mailto: javascript: vbscript: and so on | ||
@@ -25,0 +34,0 @@ if (data.origin === 'null') return false; |
'use strict'; | ||
const { DomHandler, DomUtils, Parser } = require('htmlparser2'); | ||
const escapeHTML = require('./escape_html'); | ||
const nonWord = /^\s*[^a-zA-Z0-9]\s*$/; | ||
@@ -11,10 +12,8 @@ const parseHtml = html => { | ||
const getId = ele => { | ||
const { id } = ele.attribs; | ||
const { parent } = ele; | ||
return id || (!parent ? null : getId(parent)); | ||
const getId = ({ attribs, parent }) => { | ||
return attribs.id || (!parent ? '' : getId(parent)); | ||
}; | ||
function tocObj(str, options = {}) { | ||
options = Object.assign({ | ||
const { min_depth, max_depth } = Object.assign({ | ||
min_depth: 1, | ||
@@ -24,15 +23,25 @@ max_depth: 6 | ||
const headingsSelector = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].slice(options.min_depth - 1, options.max_depth).join(','); | ||
const headingsSelector = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].slice(min_depth - 1, max_depth); | ||
const headings = DomUtils.find(({ tagName }) => headingsSelector.includes(tagName), parseHtml(str), true); | ||
const headingsLen = headings.length; | ||
const dom = parseHtml(str); | ||
const headings = DomUtils.find(el => headingsSelector.includes(el.tagName), dom, true); | ||
if (!headingsLen) return []; | ||
const result = []; | ||
if (!headings.length) return result; | ||
for (const el of headings) { | ||
for (let i = 0; i < headingsLen; i++) { | ||
const el = headings[i]; | ||
const level = +el.name[1]; | ||
const id = getId(el); | ||
const text = escapeHTML(DomUtils.getText(el)); | ||
let text = ''; | ||
for (const element of el.children) { | ||
const elText = DomUtils.getText(element); | ||
// Skip permalink symbol wrapped in <a> | ||
// permalink is a single non-word character, word = [a-Z0-9] | ||
// permalink may be wrapped in whitespace(s) | ||
if (element.name !== 'a' || !nonWord.test(elText)) { | ||
text += escapeHTML(elText); | ||
} | ||
} | ||
if (!text) text = escapeHTML(DomUtils.getText(el)); | ||
@@ -39,0 +48,0 @@ result.push({ text, id, level }); |
@@ -31,6 +31,3 @@ 'use strict'; | ||
return cache.apply(`${config.url}-${root}-${prettyUrlsOptions.trailing_index}-${prettyUrlsOptions.trailing_html}-${path}`, () => { | ||
const pathRegex = /^(#|\/\/|http(s)?:)/; | ||
if (pathRegex.test(path)) { | ||
return path; | ||
} | ||
if (/^(#|\/\/|http(s)?:)/.test(path)) return path; | ||
@@ -37,0 +34,0 @@ const sitehost = parse(config.url).hostname || config.url; |
{ | ||
"name": "hexo-util", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "Utilities for Hexo.", | ||
@@ -41,3 +41,3 @@ "main": "lib/index", | ||
"html-tag-validator": "^1.5.0", | ||
"mocha": "^6.0.1", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0", | ||
@@ -53,3 +53,5 @@ "rewire": "^4.0.1" | ||
"htmlparser2": "^4.0.0", | ||
"prismjs": "^1.17.1", | ||
"punycode.js": "^2.1.0", | ||
"strip-indent": "^3.0.0", | ||
"striptags": "^3.1.1" | ||
@@ -56,0 +58,0 @@ }, |
@@ -34,2 +34,3 @@ # hexo-util | ||
- [prettyUrls](#prettyurlsurl-options) | ||
- [prismHighlight](#prismhighlightstr-options) | ||
- [relative_url](#relative_urlfrom-to) | ||
@@ -441,2 +442,19 @@ - [slugize](#slugizestr-options) | ||
### prismHighlight(str, [options]) | ||
Syntax highlighting for a code block using PrismJS. | ||
Option | Description | Default | ||
--- | --- | --- | ||
`lineNumber` | Whether to show line numbers | true | ||
`lang` | Language | `'none'` | ||
`tab`| Replace tabs | | ||
`isPreprocess` | Enable preprocess or not | true | ||
`mark` | Highlight specific line | | ||
`firstLine` | First line number | | ||
When `isPreprocess` is enabled, `prismHighlight()` will return PrismJS processed HTML snippet. Otherwise `str` will only be escaped and `prismHighlight()` will return the HTML snippet that is suitable for `prism.js` working in the Browser. | ||
`mark` and `firstLine` options will have effect only when `isPreprocess` is disabled. | ||
### relative_url(from, to) | ||
@@ -493,2 +511,6 @@ | ||
### stripIndent(str) | ||
Strip leading whitespace from each line in a string. The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove. Useful for removing redundant indentation. | ||
### wordWrap(str, [options]) | ||
@@ -495,0 +517,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79682
36
1346
740
10
1
+ Addedprismjs@^1.17.1
+ Addedstrip-indent@^3.0.0
+ Addedmin-indent@1.0.1(transitive)
+ Addedprismjs@1.29.0(transitive)
+ Addedstrip-indent@3.0.0(transitive)