@scalar/code-highlight 0.0.18 → 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
@@ -1,5 +1,17 @@
1
1
  # @scalar/code-highlight
2
2
 
3
+ ## 0.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 109e320: fix: removes regex for highlight credentials
8
+
9
+ ## 0.0.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 6407b2b: feat(api-reference): extend font weights for links and sidebar items
14
+
3
15
  ## 0.0.18
4
16
 
5
17
  ### Patch Changes
@@ -1,4 +1,7 @@
1
1
  import type { LanguageFn } from 'highlight.js';
2
+ /**
3
+ * Syntax highlights a code string using the `rehype-highlight` library.
4
+ */
2
5
  export declare function syntaxHighlight(codeString: string, options: {
3
6
  lang: string;
4
7
  languages: Record<string, LanguageFn>;
@@ -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,UA8CF"}
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"}
@@ -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
- ? htmlString.replace(new RegExp(credentials.join('|'), 'g'), (m) => `<span class="credentials">${m}</span>`)
44
+ ? credentials.reduce((acc, credential) => acc
45
+ .split(credential)
46
+ .join(`<span class="credentials">${credential}</span>`), htmlString)
42
47
  : htmlString;
43
48
  }
44
49
  /**
@@ -152,11 +152,13 @@
152
152
  margin-top: 0;
153
153
  }
154
154
  .markdown a {
155
- color: var(--scalar-color-accent);
155
+ color: var(--scalar-link-color, var(--scalar-color-accent));
156
+ font-weight: var(--scalar-link-font-weight, inherit);
156
157
  text-decoration: var(--scalar-text-decoration);
157
158
  cursor: pointer;
158
159
  }
159
160
  .markdown a:hover {
161
+ color: var(--scalar-link-color-hover, var(--scalar-color-accent));
160
162
  text-decoration: var(--scalar-text-decoration-hover);
161
163
  }
162
164
  .markdown em {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/scalar/scalar.git",
10
+ "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/code-highlight"
12
12
  },
13
13
  "keywords": [
@@ -16,7 +16,7 @@
16
16
  "lowlight",
17
17
  "highlightjs"
18
18
  ],
19
- "version": "0.0.18",
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.54"
96
+ "@scalar/themes": "0.9.61"
97
97
  },
98
98
  "scripts": {
99
99
  "build": "scalar-build-rollup",