diff --git a/apps/client/src/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.ts index 39eb3e71f..b6b4dc263 100644 --- a/apps/client/src/services/syntax_highlight.ts +++ b/apps/client/src/services/syntax_highlight.ts @@ -1,4 +1,4 @@ -import { ensureMimeTypes, highlight, highlightAuto, loadTheme } from "@triliumnext/highlightjs"; +import { ensureMimeTypes, highlight, highlightAuto, loadTheme, Themes } from "@triliumnext/highlightjs"; import mime_types from "./mime_types.js"; import options from "./options.js"; @@ -58,8 +58,17 @@ export async function applySingleBlockSyntaxHighlight($codeBlock: JQuery `; -// TODO: Deduplicate -interface Theme { - title: string; - val: string; -} - -type Response = Record; - /** * Contains appearance settings for code blocks within text notes, such as the theme for the syntax highlighter. */ @@ -78,10 +70,10 @@ export default class CodeBlockOptions extends OptionsWidget { this.$widget = $(TPL); this.$themeSelect = this.$widget.find(".theme-select"); // Populate the list of themes. - for (const name of Object.keys(Themes)) { + for (const [ id, theme ] of Object.entries(Themes)) { const option = $("