svelte-highlight 7.5.0 → 7.6.0
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/Highlight.svelte.d.ts +32 -14
- package/HighlightAuto.svelte.d.ts +8 -43
- package/HighlightSvelte.svelte.d.ts +8 -43
- package/LangTag.svelte +2 -2
- package/LangTag.svelte.d.ts +17 -29
- package/README.md +2 -0
- package/package.json +1 -1
package/Highlight.svelte.d.ts
CHANGED
|
@@ -2,33 +2,35 @@ import type { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
3
|
import type { LanguageType } from "./languages";
|
|
4
4
|
|
|
5
|
-
export type
|
|
6
|
-
/**
|
|
7
|
-
* Specify the text to highlight.
|
|
8
|
-
*/
|
|
9
|
-
code: any;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Provide the language grammar used to highlight the code.
|
|
13
|
-
* Import languages from `svelte-highlight/languages/*`.
|
|
14
|
-
* @example
|
|
15
|
-
* import typescript from "svelte-highlight/languages/typescript";
|
|
16
|
-
*/
|
|
17
|
-
language: LanguageType<string>;
|
|
18
|
-
|
|
5
|
+
export type LangtagProps = {
|
|
19
6
|
/**
|
|
20
7
|
* Set to `true` for the language name to be
|
|
21
8
|
* displayed at the top right of the code block.
|
|
22
9
|
*
|
|
23
10
|
* Use style props to customize styles:
|
|
11
|
+
* - `--langtag-top`
|
|
12
|
+
* - `--langtag-right`
|
|
24
13
|
* - `--langtag-background`
|
|
25
14
|
* - `--langtag-color`
|
|
26
15
|
* - `--langtag-border-radius`
|
|
16
|
+
* - `--langtag-padding`
|
|
27
17
|
*
|
|
28
18
|
* @default false
|
|
29
19
|
*/
|
|
30
20
|
langtag?: boolean;
|
|
31
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Customize the top position of the langtag.
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
"--langtag-top"?: string | number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Customize the right position of the langtag.
|
|
30
|
+
* @default 0
|
|
31
|
+
*/
|
|
32
|
+
"--langtag-right"?: string | number;
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* Customize the background color of the langtag.
|
|
34
36
|
* @default "inherit"
|
|
@@ -54,6 +56,22 @@ export type HighlightProps = HTMLAttributes<HTMLPreElement> & {
|
|
|
54
56
|
"--langtag-padding"?: string;
|
|
55
57
|
};
|
|
56
58
|
|
|
59
|
+
export type HighlightProps = HTMLAttributes<HTMLPreElement> &
|
|
60
|
+
LangtagProps & {
|
|
61
|
+
/**
|
|
62
|
+
* Specify the text to highlight.
|
|
63
|
+
*/
|
|
64
|
+
code: any;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Provide the language grammar used to highlight the code.
|
|
68
|
+
* Import languages from `svelte-highlight/languages/*`.
|
|
69
|
+
* @example
|
|
70
|
+
* import typescript from "svelte-highlight/languages/typescript";
|
|
71
|
+
*/
|
|
72
|
+
language: LanguageType<string>;
|
|
73
|
+
};
|
|
74
|
+
|
|
57
75
|
export type HighlightEvents = {
|
|
58
76
|
highlight: CustomEvent<{
|
|
59
77
|
/**
|
|
@@ -1,49 +1,14 @@
|
|
|
1
1
|
import type { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { LangtagProps } from "./Highlight.svelte";
|
|
3
4
|
|
|
4
|
-
export type HighlightAutoProps = HTMLAttributes<HTMLPreElement> &
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Set to `true` for the language name to be
|
|
12
|
-
* displayed at the top right of the code block.
|
|
13
|
-
*
|
|
14
|
-
* Use style props to customize styles:
|
|
15
|
-
* - `--langtag-background`
|
|
16
|
-
* - `--langtag-color`
|
|
17
|
-
* - `--langtag-border-radius`
|
|
18
|
-
*
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
langtag?: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Customize the background color of the langtag.
|
|
25
|
-
* @default "inherit"
|
|
26
|
-
*/
|
|
27
|
-
"--langtag-background"?: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Customize the text color of the langtag.
|
|
31
|
-
* @default "inherit"
|
|
32
|
-
*/
|
|
33
|
-
"--langtag-color"?: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Customize the border radius of the langtag.
|
|
37
|
-
* @default 0
|
|
38
|
-
*/
|
|
39
|
-
"--langtag-border-radius"?: string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Customize the padding of the langtag.
|
|
43
|
-
* @default "1em"
|
|
44
|
-
*/
|
|
45
|
-
"--langtag-padding"?: string;
|
|
46
|
-
};
|
|
5
|
+
export type HighlightAutoProps = HTMLAttributes<HTMLPreElement> &
|
|
6
|
+
LangtagProps & {
|
|
7
|
+
/**
|
|
8
|
+
* Specify the text to highlight.
|
|
9
|
+
*/
|
|
10
|
+
code: any;
|
|
11
|
+
};
|
|
47
12
|
|
|
48
13
|
export type HighlightAutoEvents = {
|
|
49
14
|
highlight: CustomEvent<{
|
|
@@ -1,49 +1,14 @@
|
|
|
1
1
|
import type { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { LangtagProps } from "./Highlight.svelte";
|
|
3
4
|
|
|
4
|
-
export type HighlightSvelteProps = HTMLAttributes<HTMLPreElement> &
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Set to `true` for the language name to be
|
|
12
|
-
* displayed at the top right of the code block.
|
|
13
|
-
*
|
|
14
|
-
* Use style props to customize styles:
|
|
15
|
-
* - `--langtag-background`
|
|
16
|
-
* - `--langtag-color`
|
|
17
|
-
* - `--langtag-border-radius`
|
|
18
|
-
*
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
langtag?: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Customize the background color of the langtag.
|
|
25
|
-
* @default "inherit"
|
|
26
|
-
*/
|
|
27
|
-
"--langtag-background"?: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Customize the text color of the langtag.
|
|
31
|
-
* @default "inherit"
|
|
32
|
-
*/
|
|
33
|
-
"--langtag-color"?: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Customize the border radius of the langtag.
|
|
37
|
-
* @default 0
|
|
38
|
-
*/
|
|
39
|
-
"--langtag-border-radius"?: string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Customize the padding of the langtag.
|
|
43
|
-
* @default "1em"
|
|
44
|
-
*/
|
|
45
|
-
"--langtag-padding"?: string;
|
|
46
|
-
};
|
|
5
|
+
export type HighlightSvelteProps = HTMLAttributes<HTMLPreElement> &
|
|
6
|
+
LangtagProps & {
|
|
7
|
+
/**
|
|
8
|
+
* Specify the text to highlight.
|
|
9
|
+
*/
|
|
10
|
+
code: any;
|
|
11
|
+
};
|
|
47
12
|
|
|
48
13
|
export type HighlightSvelteEvents = {
|
|
49
14
|
highlight: CustomEvent<{
|
package/LangTag.svelte
CHANGED
package/LangTag.svelte.d.ts
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
import type { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { LangtagProps } from "./Highlight.svelte";
|
|
3
4
|
|
|
4
|
-
export type LangTagProps = HTMLAttributes<HTMLPreElement> &
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export type LangTagProps = HTMLAttributes<HTMLPreElement> &
|
|
6
|
+
LangtagProps & {
|
|
7
|
+
/**
|
|
8
|
+
* Specify the text to highlight.
|
|
9
|
+
*/
|
|
10
|
+
code: any;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Provide the highlighted code.
|
|
14
|
+
*/
|
|
15
|
+
highlighted: string;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Set to `true` for the language name to be
|
|
23
|
-
* displayed at the top right of the code block.
|
|
24
|
-
*
|
|
25
|
-
* Use style props to customize styles:
|
|
26
|
-
* - `--langtag-background`
|
|
27
|
-
* - `--langtag-color`
|
|
28
|
-
* - `--langtag-border-radius`
|
|
29
|
-
* - `--langtag-padding`
|
|
30
|
-
*
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
langtag?: boolean;
|
|
34
|
-
};
|
|
17
|
+
/**
|
|
18
|
+
* Provide the language name.
|
|
19
|
+
* @default "plaintext"
|
|
20
|
+
*/
|
|
21
|
+
languageName?: string;
|
|
22
|
+
};
|
|
35
23
|
|
|
36
24
|
export type LangTagEvents = {};
|
|
37
25
|
|
package/README.md
CHANGED
|
@@ -283,6 +283,8 @@ See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languag
|
|
|
283
283
|
|
|
284
284
|
| Style prop | Description | Default value |
|
|
285
285
|
| :---------------------- | :------------------------------ | :------------ |
|
|
286
|
+
| --langtag-top | Top position of the langtag | `0` |
|
|
287
|
+
| --langtag-right | Right position of the langtag | `0` |
|
|
286
288
|
| --langtag-background | Background color of the langtag | `inherit` |
|
|
287
289
|
| --langtag-color | Text color of the langtag | `inherit` |
|
|
288
290
|
| --langtag-border-radius | Border radius of the langtag | `0` |
|