From e495960196235e0e5adfecd143e42b822e56335e Mon Sep 17 00:00:00 2001 From: Eamonn de Leastar Date: Thu, 12 Dec 2024 17:55:19 +0000 Subject: [PATCH] finalised first version of sjiki code themes --- src/lib/runes.ts | 1 - src/lib/services/models/markdown-utils.ts | 20 +++++++++++++++---- .../ui/learning-objects/content/Lab.svelte | 2 +- src/lib/ui/themes/LayoutMenu.svelte | 12 +++++------ src/lib/ui/themes/theme-controller.svelte.ts | 5 ++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/lib/runes.ts b/src/lib/runes.ts index 36854e68..104364e7 100644 --- a/src/lib/runes.ts +++ b/src/lib/runes.ts @@ -7,7 +7,6 @@ export const layout = rune("expanded"); export const lightMode = rune("light"); export const currentTheme = rune("tutors"); export const currentCodeTheme = rune("monokai"); -export const refreshCodeTheme = rune(false); export const currentLo = rune(null); export const currentCourse = rune(null); diff --git a/src/lib/services/models/markdown-utils.ts b/src/lib/services/models/markdown-utils.ts index 60a29f77..ec567ca6 100644 --- a/src/lib/services/models/markdown-utils.ts +++ b/src/lib/services/models/markdown-utils.ts @@ -50,8 +50,9 @@ import solarizedDark from "shiki/themes/solarized-dark.mjs"; import solarizedLight from "shiki/themes/solarized-light.mjs"; import nightOwl from "shiki/themes/night-owl.mjs"; import githubDark from "shiki/themes/github-dark.mjs"; -import catppuccinMocha from "shiki/themes/catppuccin-mocha.mjs"; - +import dracula from "shiki/themes/dracula.mjs"; +import snazziLight from "shiki/themes/snazzy-light.mjs"; +import githubLightHighContrast from "shiki/themes/github-light-high-contrast.mjs"; const languages = [ js, ts, @@ -77,15 +78,26 @@ const languages = [ html ]; +export const codeThemes = [ + monokai, + solarizedLight, + githubDark, + githubLightHighContrast, + nightOwl, + dracula, + solarizedDark, + snazziLight +]; + const shiki = createHighlighterCoreSync({ - themes: [monokai, nightOwl, githubDark, catppuccinMocha, solarizedDark, solarizedLight], + themes: codeThemes, langs: languages, engine: createJavaScriptRegexEngine() }); let currentTheme = "monokai"; -export const markdownIt: any = new MarkdownIt({ +export const markdownIt = new MarkdownIt({ html: true, // Enable HTML tags in source xhtmlOut: false, // Use '/' to close single tags (
). breaks: false, // Convert '\n' in paragraphs into
diff --git a/src/lib/ui/learning-objects/content/Lab.svelte b/src/lib/ui/learning-objects/content/Lab.svelte index a78f81fe..91448ef2 100644 --- a/src/lib/ui/learning-objects/content/Lab.svelte +++ b/src/lib/ui/learning-objects/content/Lab.svelte @@ -6,7 +6,7 @@ import type { LiveLab } from "$lib/services/models/live-lab"; import { fly } from "svelte/transition"; import { slideFromLeft } from "$lib/ui/themes/animations"; - import { currentCodeTheme, refreshCodeTheme } from "$lib/runes"; + import { currentCodeTheme } from "$lib/runes"; interface Props { lab: LiveLab; diff --git a/src/lib/ui/themes/LayoutMenu.svelte b/src/lib/ui/themes/LayoutMenu.svelte index fe26386d..2c484521 100644 --- a/src/lib/ui/themes/LayoutMenu.svelte +++ b/src/lib/ui/themes/LayoutMenu.svelte @@ -1,11 +1,12 @@