mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
server: Refactor code block theme search into own service
This commit is contained in:
17
src/services/code_block_theme.ts
Normal file
17
src/services/code_block_theme.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import fs from "fs";
|
||||
|
||||
export function listSyntaxHighlightingThemes() {
|
||||
const path = "node_modules/@highlightjs/cdn-assets/styles";
|
||||
const allThemes = fs
|
||||
.readdirSync(path)
|
||||
.filter((el) => el.endsWith(".min.css"))
|
||||
.map((name) => {
|
||||
const nameWithoutExtension = name.replace(".min.css", "");
|
||||
|
||||
return {
|
||||
val: `default:${nameWithoutExtension}`,
|
||||
title: nameWithoutExtension.replace(/-/g, " ")
|
||||
};
|
||||
});
|
||||
return allThemes;
|
||||
}
|
||||
Reference in New Issue
Block a user