diff options
author | Indrajith K L | 2024-02-05 04:15:02 +0530 |
---|---|---|
committer | Indrajith K L | 2024-02-05 04:15:02 +0530 |
commit | f05a472585b2506da21aed71f0252b2d4c04a221 (patch) | |
tree | 4f65a3801f29250a049f3cc5cd2ac9c0a41d78f9 /src/lib/languages/svelte.ts | |
download | react-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.tar.gz react-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.tar.bz2 react-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.zip |
React Slides
* Adds useState
* State
* useEffect
* Side Effects
Diffstat (limited to 'src/lib/languages/svelte.ts')
-rw-r--r-- | src/lib/languages/svelte.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/languages/svelte.ts b/src/lib/languages/svelte.ts new file mode 100644 index 0000000..237c7c7 --- /dev/null +++ b/src/lib/languages/svelte.ts @@ -0,0 +1,50 @@ +import type { Hljs } from './types' + +export function svelte(hljs: Hljs) { + return { + subLanguage: 'xml', + contains: [ + hljs.COMMENT('<!--', '-->', { + relevance: 10, + }), + { + begin: /^(\s*)(<script(\s*context="module")?>)/gm, + end: /^(\s*)(<\/script>)/gm, + subLanguage: 'javascript', + excludeBegin: true, + excludeEnd: true, + contains: [ + { + begin: /^(\s*)(\$:)/gm, + end: /(\s*)/gm, + className: 'keyword', + }, + ], + }, + { + begin: /^(\s*)(<style.*>)/gm, + end: /^(\s*)(<\/style>)/gm, + subLanguage: 'css', + excludeBegin: true, + excludeEnd: true, + }, + { + begin: /\{/gm, + end: /\}/gm, + subLanguage: 'javascript', + contains: [ + { + begin: /[\{]/, + end: /[\}]/, + skip: true, + }, + { + begin: /([#:\/@])(if|else|each|await|then|catch|debug|html)/gm, + className: 'keyword', + relevance: 10, + }, + ], + }, + ], + } +} |