Skip to content

Commit b62d692

Browse files
authored
Add Markdown support to CodeMirror component (#7961)
#### What type of PR is this? /kind feature /area ui /milestone 2.22.x #### What this PR does / why we need it: Add Markdown support to CodeMirror component #### Does this PR introduce a user-facing change? ```release-note None ```
1 parent 6f711fc commit b62d692

File tree

3 files changed

+51
-30
lines changed

3 files changed

+51
-30
lines changed

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@codemirror/lang-html": "^6.4.11",
4949
"@codemirror/lang-javascript": "^6.2.4",
5050
"@codemirror/lang-json": "^6.0.2",
51+
"@codemirror/lang-markdown": "^6.5.0",
5152
"@codemirror/lang-yaml": "^6.1.2",
5253
"@codemirror/language": "^6.11.3",
5354
"@codemirror/state": "^6.5.2",

ui/pnpm-lock.yaml

Lines changed: 43 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/components/codemirror/supports.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export const presetLanguages = {
2525
const { json } = await import("@codemirror/lang-json");
2626
return json();
2727
},
28+
markdown: async (): Promise<LanguageSupport> => {
29+
const { markdown } = await import("@codemirror/lang-markdown");
30+
return markdown({
31+
addKeymap: true,
32+
completeHTMLTags: true,
33+
});
34+
},
2835
} satisfies Record<string, () => Promise<LanguageSupport>>;
2936

3037
export interface CodemirrorProps {

0 commit comments

Comments
 (0)