client,server: Allow disabling syntax highlight

This commit is contained in:
Elian Doran
2024-10-31 18:03:52 +02:00
parent bbc038f254
commit ac13291744
4 changed files with 20 additions and 3 deletions

View File

@@ -1,9 +1,10 @@
import fs from "fs";
import themeNames from "./code_block_theme_names.json" assert { type: "json" }
import { t } from "i18next";
export function listSyntaxHighlightingThemes() {
const path = "node_modules/@highlightjs/cdn-assets/styles";
const allThemes = fs
const systemThemes = fs
.readdirSync(path)
.filter((el) => el.endsWith(".min.css"))
.map((name) => {
@@ -19,5 +20,11 @@ export function listSyntaxHighlightingThemes() {
title: title
};
});
return allThemes;
return [
{
val: "none",
title: t("code_block.theme_none")
},
...systemThemes
];
}