Skip to content

Commit 5d8d682

Browse files
committed
feat: code blocks for MarkDown editor
1 parent 1297c06 commit 5d8d682

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

frontend/src/commons/custom_fields/MarkdownEdit.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
ListsToggle,
1111
MDXEditor,
1212
Separator,
13+
codeBlockPlugin,
14+
codeMirrorPlugin,
1315
diffSourcePlugin,
1416
headingsPlugin,
1517
imagePlugin,
@@ -85,6 +87,24 @@ const MarkdownEdit = ({ label, initialValue, setValue, overlayContainer, maxLeng
8587
codeMirrorExtensions: [codemirror_theme],
8688
}),
8789
maxLengthPlugin(maxLength),
90+
codeBlockPlugin({ defaultCodeBlockLanguage: "txt" }),
91+
codeMirrorPlugin({
92+
codeBlockLanguages: {
93+
js: "JavaScript",
94+
ts: "TypeScript",
95+
python: "Python",
96+
java: "Java",
97+
csharp: "C#",
98+
cpp: "C++",
99+
go: "Go",
100+
rust: "Rust",
101+
php: "PHP",
102+
sql: "SQL",
103+
json: "JSON",
104+
yaml: "YAML",
105+
xml: "XML",
106+
},
107+
}),
88108
];
89109

90110
return (

0 commit comments

Comments
 (0)