chore: better Prettier config for easier reviews

This commit is contained in:
2023-10-23 23:33:39 +02:00
parent a8781724d4
commit 71ea41695f
209 changed files with 4093 additions and 4114 deletions

View File

@@ -1,16 +1,16 @@
import { useMemo } from 'react'
import ReactMarkdown from 'react-markdown'
import gfm from 'remark-gfm'
import remarkBreaks from 'remark-breaks'
import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism'
import { useMemo } from "react"
import ReactMarkdown from "react-markdown"
import gfm from "remark-gfm"
import remarkBreaks from "remark-breaks"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"
import { vscDarkPlus } from "react-syntax-highlighter/dist/cjs/styles/prism"
import 'katex/dist/katex.min.css'
import "katex/dist/katex.min.css"
import { Emoji, emojiPlugin, isStringWithOnlyOneEmoji } from '../../../../Emoji'
import type { MessageWithMember } from '../../../../../models/Message'
import { Emoji, emojiPlugin, isStringWithOnlyOneEmoji } from "../../../../Emoji"
import type { MessageWithMember } from "../../../../../models/Message"
export interface MessageContentProps {
message: MessageWithMember
@@ -35,16 +35,16 @@ export const MessageText: React.FC<MessageContentProps> = (props) => {
return (
<ReactMarkdown
disallowedElements={['table']}
disallowedElements={["table"]}
unwrapDisallowed
remarkPlugins={[[gfm], [remarkBreaks], [remarkMath]]}
rehypePlugins={[[emojiPlugin], [rehypeKatex]]}
linkTarget='_blank'
linkTarget="_blank"
components={{
a: (props) => {
return (
<a
className='text-green-800 hover:underline dark:text-green-400'
className="text-green-800 hover:underline dark:text-green-400"
{...props}
/>
)
@@ -55,22 +55,22 @@ export const MessageText: React.FC<MessageContentProps> = (props) => {
},
code: (properties) => {
const { inline, className, children, ...props } = properties
const match = /language-(\w+)/.exec(className ?? '')
const match = /language-(\w+)/.exec(className ?? "")
return !(inline as boolean) && match != null ? (
<SyntaxHighlighter
style={vscDarkPlus as any}
language={match[1]}
PreTag='div'
PreTag="div"
{...props}
>
{String(children).replace(/\n$/, '')}
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
) : (
<code className={className} {...props}>
{children}
</code>
)
}
},
}}
>
{message.value}

View File

@@ -1 +1 @@
export * from './MessageText'
export * from "./MessageText"