Comparing version 3.2.0 to 3.3.0
@@ -1,2 +0,2 @@ | ||
declare function camelCaseKeys(obj: object): {}; | ||
declare function camelCaseKeys(obj: object): Record<string, any>; | ||
export = camelCaseKeys; |
@@ -1,2 +0,2 @@ | ||
declare function fullUrlForHelper(path?: string): unknown; | ||
declare function fullUrlForHelper(path?: string): string; | ||
export = fullUrlForHelper; |
/// <reference types="node" /> | ||
import { ParsedUrlQueryInput } from 'querystring'; | ||
declare function gravatarHelper(email: string, options: ParsedUrlQueryInput): string; | ||
declare function gravatarHelper(email: string, options?: ParsedUrlQueryInput | number): string; | ||
export = gravatarHelper; |
@@ -12,4 +12,5 @@ interface Options { | ||
wrap?: boolean; | ||
stripIndent?: boolean; | ||
} | ||
declare function highlightUtil(str: string, options?: Options): string; | ||
export = highlightUtil; |
@@ -12,6 +12,8 @@ "use strict"; | ||
throw new TypeError('str must be a string!'); | ||
str = (0, strip_indent_1.default)(str); | ||
const useHljs = Object.prototype.hasOwnProperty.call(options, 'hljs') ? options.hljs : false; | ||
const { gutter = true, firstLine = 1, caption, mark = [], languageAttr = false, tab } = options; | ||
const { gutter = true, firstLine = 1, caption, mark = [], languageAttr = false, tab, stripIndent: enableStripIndent = true } = options; | ||
let { wrap = true } = options; | ||
if (enableStripIndent) { | ||
str = (0, strip_indent_1.default)(str); | ||
} | ||
if (!hljs) { | ||
@@ -18,0 +20,0 @@ hljs = require('highlight.js'); |
@@ -1,4 +0,4 @@ | ||
declare function htmlTag(tag: string, attrs: { | ||
[key: string]: string | boolean | null | undefined; | ||
declare function htmlTag(tag: string, attrs?: { | ||
[key: string]: string | boolean | number | null | undefined; | ||
}, text?: string, escape?: boolean): string; | ||
export = htmlTag; |
@@ -9,4 +9,5 @@ interface Options { | ||
tab?: string; | ||
stripIndent?: boolean; | ||
} | ||
declare function PrismUtil(str: string, options?: Options): string; | ||
export = PrismUtil; |
@@ -57,4 +57,6 @@ "use strict"; | ||
throw new TypeError('str must be a string!'); | ||
str = (0, strip_indent_1.default)(str); | ||
const { lineNumber = true, lang = 'none', tab, mark, firstLine, isPreprocess = true, caption } = options; | ||
const { lineNumber = true, lang = 'none', tab, mark, firstLine, isPreprocess = true, caption, stripIndent: enableStripIndent = true } = options; | ||
if (enableStripIndent) { | ||
str = (0, strip_indent_1.default)(str); | ||
} | ||
// To be consistent with highlight.js | ||
@@ -61,0 +63,0 @@ let language = lang === 'plaintext' || lang === 'none' ? 'none' : lang; |
@@ -1,2 +0,8 @@ | ||
declare function tocObj(str: string, options?: {}): any[]; | ||
interface Result { | ||
text: string; | ||
id: string; | ||
level: number; | ||
unnumbered?: boolean; | ||
} | ||
declare function tocObj(str: string, options?: {}): Result[]; | ||
export = tocObj; |
{ | ||
"name": "hexo-util", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Utilities for Hexo.", | ||
@@ -24,3 +24,6 @@ "main": "dist/index", | ||
], | ||
"repository": "hexojs/hexo-util", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hexojs/hexo-util.git" | ||
}, | ||
"homepage": "https://hexo.io/", | ||
@@ -38,8 +41,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/chai": "^4.3.11", | ||
"@types/cross-spawn": "^6.0.2", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^18.11.8", | ||
"@types/prismjs": "^1.26.0", | ||
"c8": "^8.0.1", | ||
"@types/rewire": "^2.5.30", | ||
"c8": "^9.1.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"domhandler": "^5.0.3", | ||
"eslint": "^8.23.0", | ||
@@ -46,0 +52,0 @@ "eslint-config-hexo": "^5.0.0", |
@@ -292,2 +292,3 @@ # hexo-util | ||
`languageAttr` | Output code language into `data-language` attr | false | ||
`stripIndent`| Whether to strip leading whitespace via [strip-indent](https://www.npmjs.com/package/strip-indent) | true | ||
@@ -455,3 +456,5 @@ ### htmlTag(tag, attrs, text, escape) | ||
`caption` | Caption | | ||
`stripIndent`| Whether to strip leading whitespace via [strip-indent](https://www.npmjs.com/package/strip-indent) | true | ||
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. | ||
@@ -458,0 +461,0 @@ |
const hljs = require('highlight.js'); | ||
const languages = hljs.listLanguages(); | ||
const fs = require('fs'); | ||
const languages = hljs.listLanguages(); | ||
const result = { | ||
@@ -13,4 +13,3 @@ languages: languages, | ||
const def = require('highlight.js/lib/languages/' + lang)(hljs); | ||
const aliases = def.aliases; | ||
const aliases = hljs.getLanguage(lang).aliases; | ||
@@ -17,0 +16,0 @@ if (aliases) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
172894
1861
759
1
17