diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index f56d2affe..cb1d2ab95 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.ts index e3febc6bd..13a4b65d2 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.ts index 81c171c88..490ce8606 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 Promise | (() => LanguageSupport)>) | null> = { +const byMimeType: Record Promise | LanguageSupport>) | null> = { "text/plain": null, "application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart, @@ -71,14 +71,19 @@ const byMimeType: Record Promise | (() => 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 Promise | (() => 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.yaml index 5fcec2fed..a6d5cf32e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1157,6 +1157,9 @@ importers: '@codemirror/commands': specifier: 6.8.1 version: 6.8.1 + '@codemirror/lang-markdown': + specifier: 6.3.2 + version: 6.3.2 '@codemirror/legacy-modes': specifier: 6.5.1 version: 6.5.1 @@ -2154,15 +2157,33 @@ packages: '@ckeditor/ckeditor5-word-count@45.0.0': resolution: {integrity: sha512-72Fd2mUKN8dXRMKGKLPhUiQHhoGnp0ZyPwP8Ezcpbwfn/mh5SBxP3LyQGg35sKy1xJgDYywHlWvjVhw95LgIjg==} + '@codemirror/autocomplete@6.18.6': + resolution: {integrity: sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg==} + '@codemirror/commands@6.8.1': resolution: {integrity: sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==} + '@codemirror/lang-css@6.3.1': + resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} + + '@codemirror/lang-html@6.4.9': + resolution: {integrity: sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q==} + + '@codemirror/lang-javascript@6.2.3': + resolution: {integrity: sha512-8PR3vIWg7pSu7ur8A07pGiYHgy3hHj+mRYRCSG8q+mPIrl0F02rgpGv+DsQTHRTc30rydOsf5PZ7yjKFg2Ackw==} + + '@codemirror/lang-markdown@6.3.2': + resolution: {integrity: sha512-c/5MYinGbFxYl4itE9q/rgN/sMTjOr8XL5OWnC+EaRMLfCbVUmmubTJfdgpfcSS2SCaT7b+Q+xi3l6CgoE+BsA==} + '@codemirror/language@6.11.0': resolution: {integrity: sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ==} '@codemirror/legacy-modes@6.5.1': resolution: {integrity: sha512-DJYQQ00N1/KdESpZV7jg9hafof/iBNp9h7TYo1SLMk86TWl9uDsVdho2dzd81K+v4retmK6mdC7WpuOQDytQqw==} + '@codemirror/lint@6.8.5': + resolution: {integrity: sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==} + '@codemirror/search@6.5.10': resolution: {integrity: sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg==} @@ -3363,12 +3384,24 @@ packages: '@lezer/common@1.2.3': resolution: {integrity: sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==} + '@lezer/css@1.1.11': + resolution: {integrity: sha512-FuAnusbLBl1SEAtfN8NdShxYJiESKw9LAFysfea1T96jD3ydBn12oYjaSG1a04BQRIUd93/0D8e5CV1cUMkmQg==} + '@lezer/highlight@1.2.1': resolution: {integrity: sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==} + '@lezer/html@1.3.10': + resolution: {integrity: sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w==} + + '@lezer/javascript@1.5.1': + resolution: {integrity: sha512-ATOImjeVJuvgm3JQ/bpo2Tmv55HSScE2MTPnKRMRIPx2cLhHGyX2VnqpHhtIV1tVzIjZDbcWQm+NCTF40ggZVw==} + '@lezer/lr@1.4.2': resolution: {integrity: sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==} + '@lezer/markdown@1.4.3': + resolution: {integrity: sha512-kfw+2uMrQ/wy/+ONfrH83OkdFNM0ye5Xq96cLlaCy7h5UT9FO54DU4oRoIc0CSBh5NWmWuiIJA7NGLMJbQ+Oxg==} + '@ljharb/resumer@0.0.1': resolution: {integrity: sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==} engines: {node: '>= 0.4'} @@ -15208,23 +15241,27 @@ snapshots: - supports-color - utf-8-validate - '@ckeditor/ckeditor5-collaboration-core@45.0.0': + '@ckeditor/ckeditor5-collaboration-core@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-comments': 45.0.0 '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-icons': 45.0.0 '@ckeditor/ckeditor5-theme-lark': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-track-changes': 45.0.0 + '@ckeditor/ckeditor5-track-changes': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-ui': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-utils': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@types/luxon': 3.4.2 ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) luxon: 3.5.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate '@ckeditor/ckeditor5-comments@45.0.0': dependencies: '@ckeditor/ckeditor5-clipboard': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-collaboration-core': 45.0.0 + '@ckeditor/ckeditor5-collaboration-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-engine': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-enter': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -15245,7 +15282,7 @@ snapshots: '@ckeditor/ckeditor5-comments@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-clipboard': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-collaboration-core': 45.0.0 + '@ckeditor/ckeditor5-collaboration-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-engine': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-enter': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -15684,14 +15721,6 @@ snapshots: - supports-color - utf-8-validate - '@ckeditor/ckeditor5-highlight@45.0.0': - dependencies: - '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-icons': 45.0.0 - '@ckeditor/ckeditor5-ui': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-utils': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) - '@ckeditor/ckeditor5-highlight@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -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(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-track-changes': 45.0.0 + '@ckeditor/ckeditor5-track-changes': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-ui': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-utils': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) @@ -16275,7 +16304,7 @@ snapshots: - supports-color - utf-8-validate - '@ckeditor/ckeditor5-track-changes@45.0.0': + '@ckeditor/ckeditor5-track-changes@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-clipboard': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@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(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-heading': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-highlight': 45.0.0 + '@ckeditor/ckeditor5-highlight': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-icons': 45.0.0 '@ckeditor/ckeditor5-image': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-link': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -16304,6 +16333,10 @@ snapshots: ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) ckeditor5-collaboration: 45.0.0 es-toolkit: 1.32.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate '@ckeditor/ckeditor5-typing@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: @@ -16410,6 +16443,13 @@ snapshots: - supports-color - utf-8-validate + '@codemirror/autocomplete@6.18.6': + dependencies: + '@codemirror/language': 6.11.0 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.36.7 + '@lezer/common': 1.2.3 + '@codemirror/commands@6.8.1': dependencies: '@codemirror/language': 6.11.0 @@ -16417,6 +16457,46 @@ snapshots: '@codemirror/view': 6.36.7 '@lezer/common': 1.2.3 + '@codemirror/lang-css@6.3.1': + 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/lang-html@6.4.9': + 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/lang-javascript@6.2.3': + 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/lang-markdown@6.3.2': + 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/language@6.11.0': dependencies: '@codemirror/state': 6.5.2 @@ -16430,6 +16510,12 @@ snapshots: dependencies: '@codemirror/language': 6.11.0 + '@codemirror/lint@6.8.5': + dependencies: + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.36.7 + crelt: 1.0.6 + '@codemirror/search@6.5.10': dependencies: '@codemirror/state': 6.5.2 @@ -17834,14 +17920,37 @@ snapshots: '@lezer/common@1.2.3': {} + '@lezer/css@1.1.11': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@lezer/highlight@1.2.1': dependencies: '@lezer/common': 1.2.3 + '@lezer/html@1.3.10': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/javascript@1.5.1': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@lezer/lr@1.4.2': dependencies: '@lezer/common': 1.2.3 + '@lezer/markdown@1.4.3': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@ljharb/resumer@0.0.1': dependencies: '@ljharb/through': 2.3.14 @@ -21603,7 +21712,7 @@ snapshots: ckeditor5-collaboration@45.0.0: dependencies: - '@ckeditor/ckeditor5-collaboration-core': 45.0.0 + '@ckeditor/ckeditor5-collaboration-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) ckeditor5@45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41): dependencies: @@ -21634,7 +21743,7 @@ snapshots: '@ckeditor/ckeditor5-font': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-fullscreen': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-heading': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-highlight': 45.0.0 + '@ckeditor/ckeditor5-highlight': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-horizontal-line': 45.0.0 '@ckeditor/ckeditor5-html-embed': 45.0.0 '@ckeditor/ckeditor5-html-support': 45.0.0