Skip to content

Commit aee1f89

Browse files
authored
feat: 添加对 Go 语言的支持 (#165)
1 parent 14ac7b7 commit aee1f89

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@codemirror/commands": "^6.10.0",
4242
"@codemirror/comment": "^0.19.1",
4343
"@codemirror/lang-css": "^6.3.1",
44+
"@codemirror/lang-go": "^6.0.1",
4445
"@codemirror/lang-html": "^6.4.11",
4546
"@codemirror/lang-javascript": "^6.2.4",
4647
"@codemirror/lang-json": "^6.0.2",

src/core/nodeviews/code-block.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { html } from "@codemirror/lang-html";
2626
import { css } from "@codemirror/lang-css";
2727
import { json } from "@codemirror/lang-json";
2828
import { markdown } from "@codemirror/lang-markdown";
29+
import { go } from "@codemirror/lang-go";
2930
import { sourceViewManager } from "../decorations";
3031
import { searchPluginKey } from "../plugins/search";
3132

@@ -323,6 +324,8 @@ const languageExtensions: Record<string, () => any> = {
323324
json: json,
324325
markdown: markdown,
325326
md: markdown,
327+
go: go,
328+
golang: go,
326329
};
327330

328331
/** 语言别名映射(用于显示) */
@@ -348,6 +351,7 @@ const supportedLanguages = [
348351
{ value: "bash", label: "Bash" },
349352
{ value: "yaml", label: "YAML" },
350353
{ value: "xml", label: "XML" },
354+
{ value: "go", label: "Go" },
351355
];
352356

353357
/** Mermaid 显示模式选项 */

0 commit comments

Comments
 (0)