svelte-highlight 7.4.7 → 7.5.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.
@@ -31,18 +31,27 @@ export type HighlightProps = HTMLAttributes<HTMLPreElement> & {
31
31
 
32
32
  /**
33
33
  * Customize the background color of the langtag.
34
+ * @default "inherit"
34
35
  */
35
36
  "--langtag-background"?: string;
36
37
 
37
38
  /**
38
39
  * Customize the text color of the langtag.
40
+ * @default "inherit"
39
41
  */
40
42
  "--langtag-color"?: string;
41
43
 
42
44
  /**
43
45
  * Customize the border radius of the langtag.
46
+ * @default 0
44
47
  */
45
48
  "--langtag-border-radius"?: string;
49
+
50
+ /**
51
+ * Customize the padding of the langtag.
52
+ * @default "1em"
53
+ */
54
+ "--langtag-padding"?: string;
46
55
  };
47
56
 
48
57
  export type HighlightEvents = {
@@ -22,18 +22,27 @@ export type HighlightAutoProps = HTMLAttributes<HTMLPreElement> & {
22
22
 
23
23
  /**
24
24
  * Customize the background color of the langtag.
25
+ * @default "inherit"
25
26
  */
26
27
  "--langtag-background"?: string;
27
28
 
28
29
  /**
29
30
  * Customize the text color of the langtag.
31
+ * @default "inherit"
30
32
  */
31
33
  "--langtag-color"?: string;
32
34
 
33
35
  /**
34
36
  * Customize the border radius of the langtag.
37
+ * @default 0
35
38
  */
36
39
  "--langtag-border-radius"?: string;
40
+
41
+ /**
42
+ * Customize the padding of the langtag.
43
+ * @default "1em"
44
+ */
45
+ "--langtag-padding"?: string;
37
46
  };
38
47
 
39
48
  export type HighlightAutoEvents = {
@@ -22,18 +22,27 @@ export type HighlightSvelteProps = HTMLAttributes<HTMLPreElement> & {
22
22
 
23
23
  /**
24
24
  * Customize the background color of the langtag.
25
+ * @default "inherit"
25
26
  */
26
27
  "--langtag-background"?: string;
27
28
 
28
29
  /**
29
30
  * Customize the text color of the langtag.
31
+ * @default "inherit"
30
32
  */
31
33
  "--langtag-color"?: string;
32
34
 
33
35
  /**
34
36
  * Customize the border radius of the langtag.
37
+ * @default 0
35
38
  */
36
39
  "--langtag-border-radius"?: string;
40
+
41
+ /**
42
+ * Customize the padding of the langtag.
43
+ * @default "1em"
44
+ */
45
+ "--langtag-padding"?: string;
37
46
  };
38
47
 
39
48
  export type HighlightSvelteEvents = {
package/LangTag.svelte CHANGED
@@ -29,12 +29,12 @@
29
29
  position: absolute;
30
30
  top: 0;
31
31
  right: 0;
32
- padding: 1em;
33
32
  display: flex;
34
33
  align-items: center;
35
34
  justify-content: center;
36
35
  background: var(--langtag-background, inherit);
37
36
  color: var(--langtag-color, inherit);
38
- border-radius: var(--langtag-border-radius);
37
+ border-radius: var(--langtag-border-radius, 0);
38
+ padding: var(--langtag-padding, 1em);
39
39
  }
40
40
  </style>
@@ -26,6 +26,7 @@ export type LangTagProps = HTMLAttributes<HTMLPreElement> & {
26
26
  * - `--langtag-background`
27
27
  * - `--langtag-color`
28
28
  * - `--langtag-border-radius`
29
+ * - `--langtag-padding`
29
30
  *
30
31
  * @default false
31
32
  */
package/README.md CHANGED
@@ -286,6 +286,7 @@ See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languag
286
286
  | --langtag-background | Background color of the langtag | `inherit` |
287
287
  | --langtag-color | Text color of the langtag | `inherit` |
288
288
  | --langtag-border-radius | Border radius of the langtag | `0` |
289
+ | --langtag-padding | Padding of the langtag | `1em` |
289
290
 
290
291
  ```svelte
291
292
  <script>
@@ -297,12 +298,15 @@ See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languag
297
298
  <HighlightAuto {code} langtag />
298
299
  ```
299
300
 
300
- ```css
301
- [data-language="css"] {
302
- --langtag-background: linear-gradient(135deg, #2996cf, 80%, white);
303
- --langtag-color: #fff;
304
- --langtag-border-radius: 8px;
305
- }
301
+ ```svelte
302
+ <HighlightAuto
303
+ {code}
304
+ langtag
305
+ --langtag-background="linear-gradient(135deg, #2996cf, 80%, white)"
306
+ --langtag-color="#fff"
307
+ --langtag-border-radius="6px"
308
+ --langtag-padding="0.5rem"
309
+ />
306
310
  ```
307
311
 
308
312
  ## Custom Language
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-highlight",
3
- "version": "7.4.7",
3
+ "version": "7.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Svelte component library for highlighting code using highlight.js",
6
6
  "author": "Eric Liu (https://github.com/metonym)",
@@ -37,14 +37,30 @@
37
37
  "./styles/*.css": {
38
38
  "import": "./styles/*.css"
39
39
  },
40
+ "./styles": {
41
+ "types": "./styles/index.d.ts",
42
+ "import": "./styles/index.js"
43
+ },
40
44
  "./styles/*": {
41
45
  "types": "./styles/*.d.ts",
42
46
  "import": "./styles/*.js"
43
47
  },
48
+ "./styles/*.js": {
49
+ "types": "./styles/*.d.ts",
50
+ "import": "./styles/*.js"
51
+ },
52
+ "./languages": {
53
+ "types": "./languages/index.d.ts",
54
+ "import": "./languages/index.js"
55
+ },
44
56
  "./languages/*": {
45
57
  "types": "./languages/*.d.ts",
46
58
  "import": "./languages/*.js"
47
59
  },
60
+ "./languages/*.js": {
61
+ "types": "./languages/*.d.ts",
62
+ "import": "./languages/*.js"
63
+ },
48
64
  "./package.json": "./package.json"
49
65
  },
50
66
  "svelte": "./index.js",