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
chore(code): integrate Markdown support
Elian Doranafa1aa32aa31
diff --git a/packages/codemirror/package.json b/packages/codemirror/package.jsonindex f56d2affe1..cb1d2ab959 100644--- a/packages/codemirror/package.json+++ b/packages/codemirror/package.json@@ -20,6 +20,7 @@},"dependencies": {"@codemirror/commands": "6.8.1",+ "@codemirror/lang-markdown": "6.3.2","@codemirror/legacy-modes": "6.5.1","@codemirror/search": "6.5.10","@codemirror/view": "6.36.7",diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.tsindex e3febc6bd4..13a4b65d24 100644--- a/packages/codemirror/src/index.ts+++ b/packages/codemirror/src/index.ts@@ -107,7 +107,7 @@ export default class CodeMirror extends EditorView {const extension = StreamLanguage.define(resolvedSyntax);newExtension.push(extension);} else {- newExtension.push(resolvedSyntax());+ newExtension.push(resolvedSyntax);}}diff --git a/packages/codemirror/src/syntax_highlighting.ts b/packages/codemirror/src/syntax_highlighting.tsindex 81c171c887..490ce86062 100644--- a/packages/codemirror/src/syntax_highlighting.ts+++ b/packages/codemirror/src/syntax_highlighting.ts@@ -1,6 +1,6 @@import { LanguageSupport, type StreamParser } from "@codemirror/language"-const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | (() => LanguageSupport)>) | null> = {+const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | LanguageSupport>) | null> = {"text/plain": null,"application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart,@@ -71,14 +71,19 @@ const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | (() => L"text/x-fsharp": async () => (await import('@codemirror/legacy-modes/mode/mllike')).fSharp,"text/x-gas": async () => (await import('@codemirror/legacy-modes/mode/gas')).gas,"text/x-gdscript": async () => (await import('./languages/gdscript.js')).gdscript,- "text/x-gfm": null,+ "text/x-gfm": async () => {+ const { markdown, markdownLanguage } = (await import('@codemirror/lang-markdown'));+ return markdown({+ base: markdownLanguage+ });+ },"text/x-go": async () => (await import('@codemirror/legacy-modes/mode/go')).go,"text/x-groovy": async () => (await import('@codemirror/legacy-modes/mode/groovy')).groovy,"text/x-gss": async () => (await import('@codemirror/legacy-modes/mode/css')).gss,"text/x-haml": null,"text/x-haskell": async () => (await import('@codemirror/legacy-modes/mode/haskell')).haskell,"text/x-haxe": async () => (await import('@codemirror/legacy-modes/mode/haxe')).haxe,- "text/x-hcl": async () => (await import('codemirror-lang-hcl')).hcl,+ "text/x-hcl": async () => (await import('codemirror-lang-hcl')).hcl(),"text/x-hxml": async () => (await import('@codemirror/legacy-modes/mode/haxe')).hxml,"text/x-idl": async () => (await import('@codemirror/legacy-modes/mode/idl')).idl,"text/x-java": async () => (await import('@codemirror/legacy-modes/mode/clike')).java,@@ -90,7 +95,7 @@ const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | (() => L"text/x-livescript": async () => (await import('@codemirror/legacy-modes/mode/livescript')).liveScript,"text/x-lua": async () => (await import('@codemirror/legacy-modes/mode/lua')).lua,"text/x-mariadb": async () => (await import('@codemirror/legacy-modes/mode/sql')).sqlite,- "text/x-markdown": null,+ "text/x-markdown": async () => ((await import('@codemirror/lang-markdown')).markdown()),"text/x-mathematica": async () => (await import('@codemirror/legacy-modes/mode/mathematica')).mathematica,"text/x-modelica": async () => (await import('@codemirror/legacy-modes/mode/modelica')).modelica,"text/x-mscgen": async () => (await import('@codemirror/legacy-modes/mode/mscgen')).mscgen,diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5fcec2fed7..a6d5cf32e1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1157,6 +1157,9 @@ importers:'@codemirror/commands':specifier: 6.8.1version: 6.8.1+ '@codemirror/lang-markdown':+ specifier: 6.3.2+ version: 6.3.2'@codemirror/legacy-modes':specifier: 6.5.1version: 6.5.1@@ -2154,15 +2157,33 @@ packages:'@ckeditor/[email protected]':resolution: {integrity: sha512-72Fd2mUKN8dXRMKGKLPhUiQHhoGnp0ZyPwP8Ezcpbwfn/mh5SBxP3LyQGg35sKy1xJgDYywHlWvjVhw95LgIjg==}+ '@codemirror/[email protected]':+ resolution: {integrity: sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg==}+'@codemirror/[email protected]':resolution: {integrity: sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==}+ '@codemirror/[email protected]':+ resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-8PR3vIWg7pSu7ur8A07pGiYHgy3hHj+mRYRCSG8q+mPIrl0F02rgpGv+DsQTHRTc30rydOsf5PZ7yjKFg2Ackw==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-c/5MYinGbFxYl4itE9q/rgN/sMTjOr8XL5OWnC+EaRMLfCbVUmmubTJfdgpfcSS2SCaT7b+Q+xi3l6CgoE+BsA==}+'@codemirror/[email protected]':resolution: {integrity: sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ==}'@codemirror/[email protected]':resolution: {integrity: sha512-DJYQQ00N1/KdESpZV7jg9hafof/iBNp9h7TYo1SLMk86TWl9uDsVdho2dzd81K+v4retmK6mdC7WpuOQDytQqw==}+ '@codemirror/[email protected]':+ resolution: {integrity: sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==}+'@codemirror/[email protected]':resolution: {integrity: sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg==}@@ -3363,12 +3384,24 @@ packages:'@lezer/[email protected]':resolution: {integrity: sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==}+ '@lezer/[email protected]':+ resolution: {integrity: sha512-FuAnusbLBl1SEAtfN8NdShxYJiESKw9LAFysfea1T96jD3ydBn12oYjaSG1a04BQRIUd93/0D8e5CV1cUMkmQg==}+'@lezer/[email protected]':resolution: {integrity: sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==}+ '@lezer/[email protected]':+ resolution: {integrity: sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w==}++ '@lezer/[email protected]':+ resolution: {integrity: sha512-ATOImjeVJuvgm3JQ/bpo2Tmv55HSScE2MTPnKRMRIPx2cLhHGyX2VnqpHhtIV1tVzIjZDbcWQm+NCTF40ggZVw==}+'@lezer/[email protected]':resolution: {integrity: sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==}+ '@lezer/[email protected]':+ resolution: {integrity: sha512-kfw+2uMrQ/wy/+ONfrH83OkdFNM0ye5Xq96cLlaCy7h5UT9FO54DU4oRoIc0CSBh5NWmWuiIJA7NGLMJbQ+Oxg==}+'@ljharb/[email protected]':resolution: {integrity: sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==}engines: {node: '>= 0.4'}@@ -15208,23 +15241,27 @@ snapshots:- supports-color- utf-8-validate- '@ckeditor/[email protected]':dependencies:'@ckeditor/ckeditor5-comments': 45.0.0'@ckeditor/ckeditor5-core': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-icons': 45.0.0'@ckeditor/ckeditor5-theme-lark': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-track-changes': 45.0.0+ '@ckeditor/ckeditor5-track-changes': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-ui': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-utils': 45.0.0([email protected])([email protected])'@types/luxon': 3.4.2ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)luxon: 3.5.0+ transitivePeerDependencies:+ - bufferutil+ - supports-color+ - utf-8-validate'@ckeditor/[email protected]':dependencies:'@ckeditor/ckeditor5-clipboard': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-collaboration-core': 45.0.0+ '@ckeditor/ckeditor5-collaboration-core': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-core': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-engine': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-enter': 45.0.0([email protected])([email protected])@@ -15245,7 +15282,7 @@ snapshots:dependencies:'@ckeditor/ckeditor5-clipboard': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-collaboration-core': 45.0.0+ '@ckeditor/ckeditor5-collaboration-core': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-core': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-engine': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-enter': 45.0.0([email protected])([email protected])@@ -15684,14 +15721,6 @@ snapshots:- supports-color- utf-8-validate- '@ckeditor/[email protected]':- dependencies:- '@ckeditor/ckeditor5-core': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-icons': 45.0.0- '@ckeditor/ckeditor5-ui': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-utils': 45.0.0([email protected])([email protected])- ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)-dependencies:'@ckeditor/ckeditor5-core': 45.0.0([email protected])([email protected])@@ -16074,7 +16103,7 @@ snapshots:'@ckeditor/ckeditor5-operations-compressor': 45.0.0'@ckeditor/ckeditor5-revision-history': 45.0.0'@ckeditor/ckeditor5-theme-lark': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-track-changes': 45.0.0+ '@ckeditor/ckeditor5-track-changes': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-ui': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-utils': 45.0.0([email protected])([email protected])ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)@@ -16275,7 +16304,7 @@ snapshots:- supports-color- utf-8-validate- '@ckeditor/[email protected]':dependencies:'@ckeditor/ckeditor5-clipboard': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-code-block': 45.0.0(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)@@ -16287,7 +16316,7 @@ snapshots:'@ckeditor/ckeditor5-find-and-replace': 45.0.0'@ckeditor/ckeditor5-font': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-heading': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-highlight': 45.0.0+ '@ckeditor/ckeditor5-highlight': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-icons': 45.0.0'@ckeditor/ckeditor5-image': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-link': 45.0.0([email protected])([email protected])@@ -16304,6 +16333,10 @@ snapshots:ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)ckeditor5-collaboration: 45.0.0es-toolkit: 1.32.0+ transitivePeerDependencies:+ - bufferutil+ - supports-color+ - utf-8-validatedependencies:@@ -16410,6 +16443,13 @@ snapshots:- supports-color- utf-8-validate+ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/language': 6.11.0+ '@codemirror/state': 6.5.2+ '@codemirror/view': 6.36.7+ '@lezer/common': 1.2.3+'@codemirror/[email protected]':dependencies:'@codemirror/language': 6.11.0@@ -16417,6 +16457,46 @@ snapshots:'@codemirror/view': 6.36.7'@lezer/common': 1.2.3+ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/autocomplete': 6.18.6+ '@codemirror/language': 6.11.0+ '@codemirror/state': 6.5.2+ '@lezer/common': 1.2.3+ '@lezer/css': 1.1.11++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/autocomplete': 6.18.6+ '@codemirror/lang-css': 6.3.1+ '@codemirror/lang-javascript': 6.2.3+ '@codemirror/language': 6.11.0+ '@codemirror/state': 6.5.2+ '@codemirror/view': 6.36.7+ '@lezer/common': 1.2.3+ '@lezer/css': 1.1.11+ '@lezer/html': 1.3.10++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/autocomplete': 6.18.6+ '@codemirror/language': 6.11.0+ '@codemirror/lint': 6.8.5+ '@codemirror/state': 6.5.2+ '@codemirror/view': 6.36.7+ '@lezer/common': 1.2.3+ '@lezer/javascript': 1.5.1++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/autocomplete': 6.18.6+ '@codemirror/lang-html': 6.4.9+ '@codemirror/language': 6.11.0+ '@codemirror/state': 6.5.2+ '@codemirror/view': 6.36.7+ '@lezer/common': 1.2.3+ '@lezer/markdown': 1.4.3+'@codemirror/[email protected]':dependencies:'@codemirror/state': 6.5.2@@ -16430,6 +16510,12 @@ snapshots:dependencies:'@codemirror/language': 6.11.0+ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/state': 6.5.2+ '@codemirror/view': 6.36.7+ crelt: 1.0.6+'@codemirror/[email protected]':dependencies:'@codemirror/state': 6.5.2@@ -17834,14 +17920,37 @@ snapshots:'@lezer/[email protected]': {}+ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.2.3+ '@lezer/highlight': 1.2.1+ '@lezer/lr': 1.4.2+'@lezer/[email protected]':dependencies:'@lezer/common': 1.2.3+ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.2.3+ '@lezer/highlight': 1.2.1+ '@lezer/lr': 1.4.2++ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.2.3+ '@lezer/highlight': 1.2.1+ '@lezer/lr': 1.4.2+'@lezer/[email protected]':dependencies:'@lezer/common': 1.2.3+ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.2.3+ '@lezer/highlight': 1.2.1+'@ljharb/[email protected]':dependencies:'@ljharb/through': 2.3.14@@ -21603,7 +21712,7 @@ snapshots:dependencies:- '@ckeditor/ckeditor5-collaboration-core': 45.0.0+ '@ckeditor/ckeditor5-collaboration-core': 45.0.0([email protected])([email protected])[email protected](patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41):dependencies:@@ -21634,7 +21743,7 @@ snapshots:'@ckeditor/ckeditor5-font': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-fullscreen': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-heading': 45.0.0([email protected])([email protected])- '@ckeditor/ckeditor5-highlight': 45.0.0+ '@ckeditor/ckeditor5-highlight': 45.0.0([email protected])([email protected])'@ckeditor/ckeditor5-horizontal-line': 45.0.0'@ckeditor/ckeditor5-html-embed': 45.0.0'@ckeditor/ckeditor5-html-support': 45.0.0