Skip to content

Commit fa094d7

Browse files
committed
Update index.html and assets for improved styling and functionality
- Replaced old JavaScript and CSS files with new versions to enhance performance and styling. - Introduced a new syntax highlighter for code blocks in the NoteView component, improving code readability. - Removed outdated CSS file to streamline asset management and reduce redundancy.
1 parent e2066fd commit fa094d7

6 files changed

Lines changed: 98 additions & 66 deletions

File tree

docs/assets/index-B9bze3Gf.js

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

docs/assets/index-BZ3BbuBp.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/index-CxGPT-Li.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/index-DV5CGxQM.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>web</title>
8-
<script type="module" crossorigin src="./assets/index-DV5CGxQM.js"></script>
9-
<link rel="stylesheet" crossorigin href="./assets/index-CxGPT-Li.css">
8+
<script type="module" crossorigin src="./assets/index-B9bze3Gf.js"></script>
9+
<link rel="stylesheet" crossorigin href="./assets/index-BZ3BbuBp.css">
1010
</head>
1111
<body>
1212
<div id="root"></div>

web/src/components/NoteView.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react';
22
import type { Note } from '@/types';
33
import ReactMarkdown from 'react-markdown';
44
import { Card, CardContent } from '@/components/ui/card';
5+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
6+
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
57

68
interface NoteViewProps {
79
note: Note;
@@ -36,7 +38,29 @@ export const NoteView: React.FC<NoteViewProps> = ({ note }) => {
3638
<Card>
3739
<CardContent className="pt-6">
3840
<article className="prose prose-slate dark:prose-invert max-w-none">
39-
<ReactMarkdown>{content}</ReactMarkdown>
41+
<ReactMarkdown
42+
components={{
43+
code({node, inline, className, children, ...props}: any) {
44+
const match = /language-(\w+)/.exec(className || '')
45+
return !inline && match ? (
46+
<SyntaxHighlighter
47+
{...props}
48+
style={vscDarkPlus}
49+
language={match[1]}
50+
PreTag="div"
51+
>
52+
{String(children).replace(/\n$/, '')}
53+
</SyntaxHighlighter>
54+
) : (
55+
<code className={className} {...props}>
56+
{children}
57+
</code>
58+
)
59+
}
60+
}}
61+
>
62+
{content}
63+
</ReactMarkdown>
4064
</article>
4165
</CardContent>
4266
</Card>

0 commit comments

Comments
 (0)