@scalar/code-highlight 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/dist/code/highlight.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/code/highlight.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAQ9C,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACrC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CACpC,
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/code/highlight.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAQ9C;;GAEG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACrC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CACpC,UAiDF"}
|
package/dist/code/highlight.js
CHANGED
|
@@ -6,6 +6,9 @@ import { visit } from 'unist-util-visit';
|
|
|
6
6
|
import { codeBlockLinesPlugin } from './line-numbers.js';
|
|
7
7
|
import { rehypeHighlight } from '../rehype-highlight/rehype-highlight.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Syntax highlights a code string using the `rehype-highlight` library.
|
|
11
|
+
*/
|
|
9
12
|
function syntaxHighlight(codeString, options) {
|
|
10
13
|
// Simple restriction on credentials to prevent unexpected behavior
|
|
11
14
|
const credentials = (typeof options?.maskCredentials === 'string'
|
|
@@ -38,7 +41,9 @@ function syntaxHighlight(codeString, options) {
|
|
|
38
41
|
const htmlString = html.toString();
|
|
39
42
|
// Replace any credentials with a wrapper element
|
|
40
43
|
return credentials.length
|
|
41
|
-
?
|
|
44
|
+
? credentials.reduce((acc, credential) => acc
|
|
45
|
+
.split(credential)
|
|
46
|
+
.join(`<span class="credentials">${credential}</span>`), htmlString)
|
|
42
47
|
: htmlString;
|
|
43
48
|
}
|
|
44
49
|
/**
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lowlight",
|
|
17
17
|
"highlightjs"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.0.
|
|
19
|
+
"version": "0.0.20",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"vite": "^5.4.10",
|
|
94
94
|
"vue": "^3.5.12",
|
|
95
95
|
"@scalar/build-tooling": "0.1.12",
|
|
96
|
-
"@scalar/themes": "0.9.
|
|
96
|
+
"@scalar/themes": "0.9.61"
|
|
97
97
|
},
|
|
98
98
|
"scripts": {
|
|
99
99
|
"build": "scalar-build-rollup",
|