Skip to content

Commit efff2f3

Browse files
committed
fix: 修复 SVG 代码块自动预览及默认语言显示
1 parent af288c3 commit efff2f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/components/markdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ export function PreCode(props: { children: any; status?: boolean }) {
536536
setOriginalCode(code);
537537

538538
const langClass = codeElement.className.match(/language-(\w+)/);
539-
let lang = langClass ? langClass[1] : "";
539+
let lang = langClass ? langClass[1] : "text";
540540
if (code.startsWith("<!DOCTYPE") || code.startsWith("<?xml")) {
541541
lang = "html";
542542
}
@@ -549,6 +549,7 @@ export function PreCode(props: { children: any; status?: boolean }) {
549549
setContentType("svg");
550550
setPreviewContent(code);
551551
setLanguage("svg");
552+
lang = "svg";
552553
} else if (lang === "html") {
553554
setLanguage("html");
554555
setContentType("html");

0 commit comments

Comments
 (0)