Skip to content

Commit 37d3bf6

Browse files
author
Kris Kratz
committed
Svelte syntax highlighting
1 parent e9db274 commit 37d3bf6

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"file-saver": "^2.0.5",
2020
"he": "^1.2.0",
2121
"highlight.js": "^11.9.0",
22+
"highlightjs-svelte": "^1.0.6",
2223
"i18next": "^23.11.3",
2324
"i18next-browser-languagedetector": "^7.2.1",
2425
"js-levenshtein": "^1.1.6",
@@ -75,4 +76,4 @@
7576
"tailwindcss": "^3.3.1",
7677
"vite": "^4.3.0"
7778
}
78-
}
79+
}

frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedChats/MarkdownRenderer.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { useState } from "react";
22
import MarkdownIt from "markdown-it";
33
import hljs from "highlight.js";
4+
import hljs_svelte from "highlightjs-svelte";
45
import { CaretDown } from "@phosphor-icons/react";
56
import "highlight.js/styles/github-dark.css";
67
import DOMPurify from "@/utils/chat/purify";
8+
hljs_svelte(hljs);
79

810
const md = new MarkdownIt({
911
html: true,

frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedConfigs/EmbedRow/CodeSnippetModal/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import React, { useState } from "react";
22
import { CheckCircle, CopySimple, X } from "@phosphor-icons/react";
33
import showToast from "@/utils/toast";
44
import hljs from "highlight.js";
5+
import hljs_svelte from "highlightjs-svelte";
56
import "@/utils/chat/themes/github-dark.css";
67
import "@/utils/chat/themes/github.css";
8+
hljs_svelte(hljs);
79

810
export default function CodeSnippetModal({ embed, closeModal }) {
911
return (

frontend/src/pages/GeneralSettings/Chats/MarkdownRenderer.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { useState } from "react";
22
import MarkdownIt from "markdown-it";
33
import hljs from "highlight.js";
4+
import hljs_svelte from "highlightjs-svelte";
45
import { CaretDown } from "@phosphor-icons/react";
56
import "highlight.js/styles/github-dark.css";
67
import DOMPurify from "@/utils/chat/purify";
8+
hljs_svelte(hljs);
79

810
const md = new MarkdownIt({
911
html: true,

frontend/src/utils/chat/markdown.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import markdownIt from "markdown-it";
33
import markdownItKatexPlugin from "./plugins/markdown-katex";
44
import Appearance from "@/models/appearance";
55
import hljs from "highlight.js";
6+
import hljs_svelte from "highlightjs-svelte";
67
import "./themes/github-dark.css";
78
import "./themes/github.css";
89
import { v4 } from "uuid";
10+
hljs_svelte(hljs);
911

1012
const markdown = markdownIt({
1113
html: Appearance.get("renderHTML") ?? false,

0 commit comments

Comments
 (0)