diff --git a/apps/server/src/services/import/mime.ts b/apps/server/src/services/import/mime.ts index 9b9895ea9..479bd3494 100644 --- a/apps/server/src/services/import/mime.ts +++ b/apps/server/src/services/import/mime.ts @@ -16,6 +16,7 @@ const CODE_MIME_TYPES = new Set([ "text/x-c++src", "text/x-csrc", "text/x-dockerfile", + "text/x-elixir", "text/x-erlang", "text/x-feature", "text/x-go", @@ -55,6 +56,8 @@ const EXTENSION_TO_MIME = new Map([ [".cs", "text/x-csharp"], [".clj", "text/x-clojure"], [".erl", "text/x-erlang"], + [".ex", "text/x-elixir"], + [".exs", "text/x-elixir"], [".hrl", "text/x-erlang"], [".feature", "text/x-feature"], [".go", "text/x-go"], diff --git a/apps/server/src/services/options_init.ts b/apps/server/src/services/options_init.ts index 4126ed321..b81507999 100644 --- a/apps/server/src/services/options_init.ts +++ b/apps/server/src/services/options_init.ts @@ -98,7 +98,7 @@ const defaultOptions: DefaultOption[] = [ { name: "codeLineWrapEnabled", value: "true", isSynced: false }, { name: "codeNotesMimeTypes", - value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-sqlite;schema=trilium","text/x-swift","text/xml","text/x-yaml","text/x-sh","application/typescript"]', + value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-elixir","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-sqlite;schema=trilium","text/x-swift","text/xml","text/x-yaml","text/x-sh","application/typescript"]', isSynced: true }, { name: "leftPaneWidth", value: "25", isSynced: false }, diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index c8cd440db..645254830 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -59,6 +59,7 @@ "@replit/codemirror-vim": "6.3.0", "@ssddanbrown/codemirror-lang-smarty": "1.0.0", "@ssddanbrown/codemirror-lang-twig": "1.0.0", + "codemirror-lang-elixir": "4.0.0", "codemirror-lang-hcl": "0.1.0", "codemirror-lang-mermaid": "0.5.0", "eslint-linter-browserify": "9.29.0" diff --git a/packages/codemirror/src/syntax_highlighting.ts b/packages/codemirror/src/syntax_highlighting.ts index 9fffa31b3..40a0d721d 100644 --- a/packages/codemirror/src/syntax_highlighting.ts +++ b/packages/codemirror/src/syntax_highlighting.ts @@ -84,6 +84,7 @@ const byMimeType: Record Promise | Language "text/x-ebnf": async () => (await import('@codemirror/legacy-modes/mode/ebnf')).ebnf, "text/x-ecl": async () => (await import('@codemirror/legacy-modes/mode/ecl')).ecl, "text/x-eiffel": async () => (await import('@codemirror/legacy-modes/mode/eiffel')).eiffel, + "text/x-elixir": async () => (await import('codemirror-lang-elixir')).elixir(), "text/x-elm": async () => (await import('@codemirror/legacy-modes/mode/elm')).elm, "text/x-erlang": async () => (await import('@codemirror/legacy-modes/mode/erlang')).erlang, "text/x-esper": async () => (await import('@codemirror/legacy-modes/mode/sql')).esper, diff --git a/packages/commons/src/lib/mime_type.ts b/packages/commons/src/lib/mime_type.ts index c2b3b2a62..ba6deafc8 100644 --- a/packages/commons/src/lib/mime_type.ts +++ b/packages/commons/src/lib/mime_type.ts @@ -69,6 +69,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([ { title: "ECL", mime: "text/x-ecl" }, { title: "edn", mime: "application/edn" }, { title: "Eiffel", mime: "text/x-eiffel" }, + { title: "Elixir", mime: "text/x-elixir", mdLanguageCode: "elixir" }, { title: "Elm", mime: "text/x-elm", mdLanguageCode: "elm" }, { title: "Embedded Javascript", mime: "application/x-ejs" }, { title: "Embedded Ruby", mime: "application/x-erb", mdLanguageCode: "erb" }, diff --git a/packages/highlightjs/src/syntax_highlighting.ts b/packages/highlightjs/src/syntax_highlighting.ts index f91f580e9..dc94d6303 100644 --- a/packages/highlightjs/src/syntax_highlighting.ts +++ b/packages/highlightjs/src/syntax_highlighting.ts @@ -64,6 +64,7 @@ const byMimeType: MimeRecord = { "text/x-ebnf": () => import("highlight.js/lib/languages/ebnf"), "text/x-ecl": null, "text/x-eiffel": null, + "text/x-elixir": () => import("highlight.js/lib/languages/elixir"), "text/x-elm": () => import("highlight.js/lib/languages/elm"), "text/x-erlang": () => import("highlight.js/lib/languages/erlang"), "text/x-esper": null, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4e6884522..47d51f558 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1289,6 +1289,9 @@ importers: '@ssddanbrown/codemirror-lang-twig': specifier: 1.0.0 version: 1.0.0 + codemirror-lang-elixir: + specifier: 4.0.0 + version: 4.0.0 codemirror-lang-hcl: specifier: 0.1.0 version: 0.1.0 @@ -6186,6 +6189,9 @@ packages: resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} + codemirror-lang-elixir@4.0.0: + resolution: {integrity: sha512-mzFesxo/t6KOxwnkqVd34R/q7yk+sMtHh6vUKGAvjwHmpL7bERHB+vQAsmU/nqrndkwVeJEHWGw/z/ybfdiudA==} + codemirror-lang-hcl@0.1.0: resolution: {integrity: sha512-duwKEaQDhkJWad4YQ9pv4282BS6hCdR+gS/qTAj3f9bypXNNZ42bIN43h9WK3DjyZRENtVlUQdrQM1sA44wHmA==} @@ -9167,6 +9173,9 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} + lezer-elixir@1.1.2: + resolution: {integrity: sha512-K3yPMJcNhqCL6ugr5NkgOC1g37rcOM38XZezO9lBXy0LwWFd8zdWXfmRbY829vZVk0OGCQoI02yDWp9FF2OWZA==} + lie@3.3.0: resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==} @@ -20215,6 +20224,11 @@ snapshots: co@4.6.0: {} + codemirror-lang-elixir@4.0.0: + dependencies: + '@codemirror/language': 6.11.0 + lezer-elixir: 1.1.2 + codemirror-lang-hcl@0.1.0: dependencies: '@codemirror/language': 6.11.0 @@ -23865,6 +23879,11 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 + lezer-elixir@1.1.2: + dependencies: + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + lie@3.3.0: dependencies: immediate: 3.0.6