Skip to content

Commit c2bb638

Browse files
authored
Change prismjs to hljs (#38)
actions 说能正常 build
1 parent e63b924 commit c2bb638

File tree

8 files changed

+35
-246
lines changed

8 files changed

+35
-246
lines changed

packages/viewer/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@
1414
"@luogu-discussion-archive/remark-lda-lfm": "workspace:*",
1515
"@prisma/client": "^5.15.0",
1616
"bootstrap": "^5.3.3",
17-
"highlight.js": "^11.9.0",
17+
"highlight.js": "^11.11.1",
1818
"jsdom": "^22.1.0",
1919
"katex": "^0.16.10",
2020
"next": "^14.2.4",
21-
"prismjs": "^1.29.0",
2221
"react": "^18.3.1",
2322
"react-dom": "^18.3.1",
2423
"react-icons": "^4.12.0",
2524
"react-infinite-scroll-component": "^6.1.0",
2625
"react-markdown": "^9.0.1",
27-
"rehype-highlight": "^6.0.0",
26+
"rehype-highlight": "^7.0.2",
2827
"rehype-katex": "^7.0.0",
29-
"rehype-prism-plus": "^2.0.0",
3028
"remark-math": "^6.0.0",
3129
"rsuite": "^5.68.1",
3230
"socket.io-client": "^4.7.5",

packages/viewer/src/app/r/[rid]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default async function Page({ params }: { params: { rid: string } }) {
5959
<div className="rounded-4 shadow-bssb">
6060
<div className="px-md-4x px-4 pt-md-3x pt-2x pb-md-4x pb-4 position-relative">
6161
<Content
62-
discussionAuthor={reply.post.snapshots[0].author.id}
62+
postAuthor={reply.post.snapshots[0].author.id}
6363
content={reply.snapshots[0].content}
6464
/>
6565
<span

packages/viewer/src/app/user/[uid]/discussions/UserDiscussions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function UserDiscussions({ uid }: { uid: string }) {
6262
}
6363
>
6464
<Content
65-
discussionAuthor={discussion.snapshots[0].author.id}
65+
postAuthor={discussion.snapshots[0].author.id}
6666
content={discussion.snapshots[0].content}
6767
// usersMetioned={discussion.usersMetioned}
6868
/>

packages/viewer/src/app/user/[uid]/participated/UserParticipated.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default function UserParticipated({
114114
</span>
115115
</summary>
116116
<Content
117-
discussionAuthor={discussion.snapshots[0].author.id}
117+
postAuthor={discussion.snapshots[0].author.id}
118118
content={discussion.snapshots[0].content}
119119
// usersMetioned={discussion.usersMetioned}
120120
/>
@@ -180,9 +180,7 @@ export default function UserParticipated({
180180
</div>
181181
<div className="px-4 py-2 position-relative">
182182
<Content
183-
discussionAuthor={
184-
discussion.snapshots[0].author.id
185-
}
183+
postAuthor={discussion.snapshots[0].author.id}
186184
content={reply.snapshots[0].content}
187185
// usersMetioned={reply.usersMetioned}
188186
/>

packages/viewer/src/components/replies/Content.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"use client";
22

33
import "katex/dist/katex.min.css";
4-
import "highlight.js/styles/tokyo-night-dark.css";
5-
import "prismjs/themes/prism-okaidia.min.css";
4+
import "highlight.js/styles/base16/tomorrow.min.css";
5+
66
import remarkLuoguFlavor from "@luogu-discussion-archive/remark-lda-lfm";
7-
import rehypePrism from "rehype-prism-plus";
7+
import rehypeHighlight from "rehype-highlight";
88

99
import { MutableRefObject, useEffect, useRef, useState } from "react";
1010

@@ -82,11 +82,11 @@ function Tooltip({
8282

8383
export default function Content({
8484
content,
85-
discussionAuthor: postAuthor,
85+
postAuthor,
8686
userMentionedState,
8787
}: {
8888
content: string;
89-
discussionAuthor: number;
89+
postAuthor: number;
9090
// eslint-disable-next-line react/require-default-props
9191
userMentionedState?: [number | null, (uid: number | null) => void];
9292
}) {
@@ -171,7 +171,7 @@ export default function Content({
171171
ref={contentRef}
172172
>
173173
<Markdown
174-
rehypePlugins={[rehypeKatex, rehypePrism]}
174+
rehypePlugins={[rehypeKatex, rehypeHighlight]}
175175
remarkPlugins={[
176176
[remarkMath, {}],
177177
[remarkLuoguFlavor, { userLinkPointToLuogu: false }],

packages/viewer/src/components/replies/ContextViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function ContextViewer({
7979
</span>
8080
)}
8181
<Content
82-
discussionAuthor={discussionAuthor}
82+
postAuthor={discussionAuthor}
8383
content={data!.reply.snapshots[0].content}
8484
/>
8585
</div>

packages/viewer/src/components/replies/Reply.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function Reply({
6969
<div className="reply-content pe-4 py-2 position-relative">
7070
{children}
7171
<Content
72-
discussionAuthor={post.authorId}
72+
postAuthor={post.authorId}
7373
content={snapshot.content}
7474
userMentionedState={[userId, setUserId]}
7575
key={userId}

0 commit comments

Comments
 (0)