Comparing version 2.6.0 to 2.6.1
@@ -9,4 +9,16 @@ 'use strict'; | ||
const prismComponents = require('prismjs/components'); | ||
const prismSupportedLanguages = Object.keys(prismComponents.languages); | ||
const prismAlias = Object.entries(prismComponents.languages).reduce((acc, [key, value]) => { | ||
if (value.alias) { | ||
if (Array.isArray(value.alias)) { | ||
value.alias.forEach(alias => (acc[alias] = key)); | ||
} else if (typeof value.alias === 'string') { | ||
acc[value.alias] = key; | ||
} | ||
} | ||
return acc; | ||
}, {}); | ||
const prismSupportedLanguages = Object.keys(prismComponents.languages).concat(Object.keys(prismAlias)); | ||
const escapeHTML = require('./escape_html'); | ||
@@ -63,4 +75,6 @@ | ||
// To be consistent with highlight.js | ||
const language = lang === 'plaintext' || lang === 'none' ? 'none' : lang; | ||
let language = lang === 'plaintext' || lang === 'none' ? 'none' : lang; | ||
if (prismAlias[language]) language = prismAlias[language]; | ||
const preTagClassArr = []; | ||
@@ -67,0 +81,0 @@ const preTagAttrArr = []; |
@@ -44,3 +44,3 @@ 'use strict'; | ||
for (const element of el.children) { | ||
const elText = DomUtils.getText(element); | ||
const elText = DomUtils.textContent(element); | ||
// Skip permalink symbol wrapped in <a> | ||
@@ -53,3 +53,3 @@ // permalink is a single non-word character, word = [a-Z0-9] | ||
} | ||
if (!text) text = escapeHTML(DomUtils.getText(el)); | ||
if (!text) text = escapeHTML(DomUtils.textContent(el)); | ||
@@ -56,0 +56,0 @@ const res = { text, id, level }; |
{ | ||
"name": "hexo-util", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"description": "Utilities for Hexo.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
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
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
83394
1428