svelte-highlight 6.1.1 → 6.1.2

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
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [6.1.1](https://github.com/metonym/svelte-highlight/releases/tag/v6.1.1) - 2022-07-02
9
+
10
+ **Fixes**
11
+
12
+ - remove `language` prop type from `HighlightAuto` TypeScript definitions
13
+
8
14
  ## [6.1.1](https://github.com/metonym/svelte-highlight/releases/tag/v6.1.1) - 2022-06-27
9
15
 
10
16
  **Refactor**
@@ -5,10 +5,21 @@ export interface Language {
5
5
  name?: string;
6
6
  register: LanguageFn;
7
7
  }
8
+ export interface Slots {
9
+ default: {
10
+ /**
11
+ * The highlighted code.
12
+ */
13
+ highlighted: HighlightedCode;
14
+ };
15
+ }
8
16
  export interface Events {
9
- highlight: {
17
+ highlight: CustomEvent<{
18
+ /**
19
+ * The highlighted code.
20
+ */
10
21
  highlighted?: HighlightedCode;
11
- };
22
+ }>;
12
23
  }
13
24
  declare const __propDef: {
14
25
  props: {
@@ -346,19 +357,17 @@ declare const __propDef: {
346
357
  /**
347
358
  * Set to `true` for the language name to be
348
359
  * displayed at the top right of the code block.
360
+ *
361
+ * Use CSS variables to customize styles:
362
+ * - `--hljs-background`
363
+ * - `--hljs-foreground`
364
+ * - `--hljs-radius`
349
365
  */
350
366
  langtag?: boolean;
351
367
  };
352
- events: {
353
- highlight: CustomEvent<any>;
354
- } & {
355
- [evt: string]: CustomEvent<any>;
356
- };
357
- slots: {
358
- default: {
359
- highlighted: HighlightedCode;
360
- };
361
- };
368
+ slots: Slots;
369
+ getters: {};
370
+ events: Events;
362
371
  };
363
372
  export declare type HighlightProps = typeof __propDef.props;
364
373
  export declare type HighlightEvents = typeof __propDef.events;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { HighlightedCode, Language } from "./Highlight.svelte";
2
+ import type { Slots, Events } from "./Highlight.svelte";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  width?: number;
@@ -328,27 +328,20 @@ declare const __propDef: {
328
328
  * Specify the source code to highlight.
329
329
  */
330
330
  code?: any;
331
- /**
332
- * Provide the language to highlight the code.
333
- * Import languages from `svelte-highlight/languages/*`.
334
- */
335
- language?: Language;
336
331
  /**
337
332
  * Set to `true` for the language name to be
338
333
  * displayed at the top right of the code block.
334
+ *
335
+ * Use CSS variables to customize styles:
336
+ * - `--hljs-background`
337
+ * - `--hljs-foreground`
338
+ * - `--hljs-radius`
339
339
  */
340
340
  langtag?: boolean;
341
341
  };
342
- events: {
343
- highlight: CustomEvent<any>;
344
- } & {
345
- [evt: string]: CustomEvent<any>;
346
- };
347
- slots: {
348
- default: {
349
- highlighted: HighlightedCode;
350
- };
351
- };
342
+ slots: Slots;
343
+ getters: {};
344
+ events: Events;
352
345
  };
353
346
  export declare type HighlightAutoProps = typeof __propDef.props;
354
347
  export declare type HighlightAutoEvents = typeof __propDef.events;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { HighlightedCode } from "./Highlight.svelte";
2
+ import type { Slots, Events } from "./Highlight.svelte";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  width?: number;
@@ -331,19 +331,17 @@ declare const __propDef: {
331
331
  /**
332
332
  * Set to `true` for the language name to be
333
333
  * displayed at the top right of the code block.
334
+ *
335
+ * Use CSS variables to customize styles:
336
+ * - `--hljs-background`
337
+ * - `--hljs-foreground`
338
+ * - `--hljs-radius`
334
339
  */
335
340
  langtag?: boolean;
336
341
  };
337
- events: {
338
- highlight: CustomEvent<any>;
339
- } & {
340
- [evt: string]: CustomEvent<any>;
341
- };
342
- slots: {
343
- default: {
344
- highlighted: HighlightedCode;
345
- };
346
- };
342
+ slots: Slots;
343
+ getters: {};
344
+ events: Events;
347
345
  };
348
346
  export declare type HighlightSvelteProps = typeof __propDef.props;
349
347
  export declare type HighlightSvelteEvents = typeof __propDef.events;
package/README.md CHANGED
@@ -41,14 +41,14 @@ export default {
41
41
  };
42
42
  ```
43
43
 
44
- Refer to [examples/sveltekit](examples/sveltekit) for an example set-up.
44
+ Refer to [examples/sveltekit](examples/sveltekit) or [examples/vite](examples/vite).
45
45
 
46
46
  ## Usage
47
47
 
48
- There are two ways to apply `highlight.js` styles:
48
+ There are two ways to apply `highlight.js` styles.
49
49
 
50
- 1. JavaScript styles injected into the DOM through `svelte:head`
51
- 2. CSS StyleSheets imported using a file loader
50
+ 1. Injected styles through [svelte:head](https://svelte.dev/docs#template-syntax-svelte-head)
51
+ 2. CSS StyleSheets
52
52
 
53
53
  ### Injected Styles
54
54
 
@@ -107,9 +107,9 @@ Use the `HighlightSvelte` component for Svelte syntax highlighting.
107
107
 
108
108
  ## Auto-highlighting
109
109
 
110
- The `HighlightAuto` component invokes the `highlightAuto` API from `highlight.js`.
110
+ The `HighlightAuto` component uses [highlightAuto](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto) API.
111
111
 
112
- Note that auto-highlighting will result in a larger bundle size in order to infer a language.
112
+ **Note:** auto-highlighting will result in a larger bundle size in order to infer a language.
113
113
 
114
114
  Prefer to specify a language if possible.
115
115
 
@@ -132,8 +132,6 @@ Prefer to specify a language if possible.
132
132
 
133
133
  All `Highlight` components apply a `data-language` attribute on the codeblock containing the language name.
134
134
 
135
- This is also compatible with custom languages.
136
-
137
135
  See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languages.
138
136
 
139
137
  ```css
@@ -146,11 +144,9 @@ See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languag
146
144
 
147
145
  All `Highlight` components allow for a tag to be added at the top-right of the codeblock displaying the language name.
148
146
 
149
- The language tag can be given a custom `background` , `color` , and `border-radius` through the custom properties shown.
150
-
151
- This is also compatible with custom languages.
147
+ The language tag can be given a custom `background` , `color` , and `border-radius` through CSS custom properties.
152
148
 
153
- It is recommended that you set values for `--hljs-background` and `--hljs-foreground` to ensure the langtags remain readable on any theme.
149
+ It is recommended that you set values for `--hljs-background` and `--hljs-foreground` to ensure the langtags are readable with your theme.
154
150
 
155
151
  See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languages.
156
152
 
@@ -194,6 +190,7 @@ Refer to the highlight.js [language definition guide](https://highlightjs.readth
194
190
  register: (hljs) => {
195
191
  return {
196
192
  /** custom language rules */
193
+ contains: [],
197
194
  };
198
195
  },
199
196
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-highlight",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "license": "MIT",
5
5
  "description": "Syntax Highlighting for Svelte using highlight.js",
6
6
  "author": "Eric Liu (https://github.com/metonym)",
@@ -13,11 +13,11 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@sveltejs/adapter-static": "1.0.0-next.34",
16
- "@sveltejs/kit": "1.0.0-next.354",
16
+ "@sveltejs/kit": "1.0.0-next.357",
17
17
  "@testing-library/svelte": "^3.1.3",
18
18
  "@testing-library/user-event": "^14.2.1",
19
19
  "@types/prettier": "^2.6.3",
20
- "carbon-components-svelte": "^0.66.0",
20
+ "carbon-components-svelte": "^0.67.0",
21
21
  "carbon-icons-svelte": "^11.1.0",
22
22
  "carbon-preprocess-svelte": "^0.9.1",
23
23
  "jsdom": "^20.0.0",