Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(highlight): add cypher
Elian Doran6a3a6243c46f
diff --git a/docs/Release Notes/Release Notes/v0.94.0.md b/docs/Release Notes/Release Notes/v0.94.0.mdindex a1770bf4ec..3b2c8e54a2 100644--- a/docs/Release Notes/Release Notes/v0.94.0.md+++ b/docs/Release Notes/Release Notes/v0.94.0.md@@ -36,6 +36,8 @@* Added the Nix language (and also in code blocks for text notes).* Added an indentation marker.* Note: syntax highlighting for some languages (mostly HTML-template languages such as EJS, JSP) is no longer supported due to lack of upstream support. If this is a problem, feel free to report an issue and we can see what can be done about it.+* Syntax highlighting in code blocks for text notes:+ * Added support for Cypher.* Mermaid diagrams: basic syntax highlight (not all diagram types are supported) and code folding.* Slight organization in Appearance settings: code block themes are now in "Text Notes", added a "Related settings" section in Appearance.* [Added support for opening and activating a note in a new tab using Ctrl+Shift+click on notes in the launcher pane, note tree, or note images](https://github.com/TriliumNext/Notes/pull/1854) by @SiriusXTdiff --git a/packages/highlightjs/package.json b/packages/highlightjs/package.jsonindex e5b0a3c07d..d498893604 100644--- a/packages/highlightjs/package.json+++ b/packages/highlightjs/package.json@@ -21,6 +21,7 @@"dependencies": {"@exercism/highlightjs-gdscript": "0.0.1","@triliumnext/commons": "workspace:*",- "highlight.js": "11.11.1"+ "highlight.js": "11.11.1",+ "highlightjs-cypher": "1.2.0"}}diff --git a/packages/highlightjs/src/syntax_highlighting.ts b/packages/highlightjs/src/syntax_highlighting.tsindex 0c38758776..f5d4abf861 100644--- a/packages/highlightjs/src/syntax_highlighting.ts+++ b/packages/highlightjs/src/syntax_highlighting.ts@@ -6,7 +6,7 @@ type MimeRecord = Record<string, (() => Promise<{ default: LanguageFn}>) | null>const byMimeType: MimeRecord = {"text/plain": () => import("highlight.js/lib/languages/plaintext"),"application/dart": () => import("highlight.js/lib/languages/dart"),- "application/edn": null,+ "application/edn": () => import("highlight.js/lib/languages/clojure"),"application/javascript;env=backend": () => import("highlight.js/lib/languages/javascript"),"application/javascript;env=frontend": () => import("highlight.js/lib/languages/javascript"),"application/json": () => import("highlight.js/lib/languages/json"),@@ -19,7 +19,7 @@ const byMimeType: MimeRecord = {"application/typescript": () => import("highlight.js/lib/languages/typescript"),"application/x-aspx": null,"application/x-bat": () => import("highlight.js/lib/languages/dos"),- "application/x-cypher-query": null,+ "application/x-cypher-query": () => import("highlightjs-cypher"),"application/x-ejs": null,"application/x-erb": () => import("highlight.js/lib/languages/erb"),"application/x-jsp": () => import("highlight.js/lib/languages/java"),diff --git a/packages/highlightjs/src/types.d.ts b/packages/highlightjs/src/types.d.tsindex ae56ed768d..e2921a2d0b 100644--- a/packages/highlightjs/src/types.d.ts+++ b/packages/highlightjs/src/types.d.ts@@ -3,3 +3,9 @@ declare module '@exercism/highlightjs-gdscript' {const defineLanguage: LanguageFn;export default defineLanguage;}++declare module 'highlightjs-cypher' {+ import { LanguageFn } from "highlight.js";+ const defineLanguage: LanguageFn;+ export default defineLanguage;+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex be2e6135d2..24f52aea74 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1292,6 +1292,9 @@ importers:highlight.js:specifier: 11.11.1version: 11.11.1+ highlightjs-cypher:+ specifier: 1.2.0+ version: 1.2.0packages/turndown-plugin-gfm:dependencies:@@ -8755,6 +8758,9 @@ packages:resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==}engines: {node: '>=12.0.0'}+ resolution: {integrity: sha512-mOY/g6R1MgXiYx07icl8nwtXCRDSy4Y9EAlDZKia8Thqe766v6cjnrD6/xWak9UXoLQfWqbHhmRmYuw0SiO+CA==}+resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==}@@ -24007,6 +24013,11 @@ snapshots:+ dependencies:+ minimist: 1.2.8+ mkdirp: 1.0.4+dependencies:'@babel/runtime': 7.27.0