svelte-highlight 7.8.3 → 7.8.4
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/README.md +16 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -334,6 +334,22 @@ Refer to the highlight.js [language definition guide](https://highlightjs.readth
|
|
|
334
334
|
<Highlight {language} code="..." />
|
|
335
335
|
```
|
|
336
336
|
|
|
337
|
+
If you're using TypeScript, use the `LanguageType` interface to type the language.
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
import type { LanguageType } from "svelte-highlight";
|
|
341
|
+
|
|
342
|
+
const language: LanguageType<"custom-language"> = {
|
|
343
|
+
name: "custom-language",
|
|
344
|
+
register: (hljs) => {
|
|
345
|
+
return {
|
|
346
|
+
/** custom language rules */
|
|
347
|
+
contains: [],
|
|
348
|
+
};
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
```
|
|
352
|
+
|
|
337
353
|
## Custom Plugin
|
|
338
354
|
|
|
339
355
|
Additional plugin languages can be installed and used separately.
|
package/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { default as Highlight, default as default } from "./Highlight.svelte";
|
|
|
2
2
|
export { default as HighlightAuto } from "./HighlightAuto.svelte";
|
|
3
3
|
export { default as HighlightSvelte } from "./HighlightSvelte.svelte";
|
|
4
4
|
export { default as LineNumbers } from "./LineNumbers.svelte";
|
|
5
|
+
export type { LanguageType } from "./languages";
|