From f05a472585b2506da21aed71f0252b2d4c04a221 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 5 Feb 2024 04:15:02 +0530 Subject: React Slides * Adds useState * State * useEffect * Side Effects --- src/lib/languages/svelte.ts | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/lib/languages/svelte.ts (limited to 'src/lib/languages/svelte.ts') 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*)()/gm, + end: /^(\s*)(<\/script>)/gm, + subLanguage: 'javascript', + excludeBegin: true, + excludeEnd: true, + contains: [ + { + begin: /^(\s*)(\$:)/gm, + end: /(\s*)/gm, + className: 'keyword', + }, + ], + }, + { + begin: /^(\s*)()/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, + }, + ], + }, + ], + } +} -- cgit v1.2.3