fix markdown?

This commit is contained in:
rngsurrounded
2025-03-03 23:44:43 +09:00
parent db78536a50
commit 368b8dd528
2 changed files with 18 additions and 2 deletions
@@ -2,7 +2,7 @@ import React from 'react';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import remarkMath from 'remark-math'; import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex'; import rehypeKatex from 'rehype-katex';
import remarkGfm from 'remark-gfm'; import remarkGfm from 'remark-gfm';
import 'katex/dist/katex.min.css'; import 'katex/dist/katex.min.css';
import { Task } from '@/shared/types/task'; import { Task } from '@/shared/types/task';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
@@ -25,6 +25,15 @@ const TaskContent: React.FC<TaskContentProps> = ({ task }) => {
const attachments = attachmentsQuery.data || []; const attachments = attachmentsQuery.data || [];
const convertToMarkdown = (text: string): string => {
if (!text) return '';
let markdown = text.replace(/\n/g, '\n\n');
return markdown;
};
const markdownText = convertToMarkdown(task.description);
return ( return (
<div className="flex-1 bg-white rounded-lg p-6"> <div className="flex-1 bg-white rounded-lg p-6">
<h2 className="text-3xl font-semibold mb-6 font-hse-sans"> <h2 className="text-3xl font-semibold mb-6 font-hse-sans">
@@ -36,7 +45,7 @@ const TaskContent: React.FC<TaskContentProps> = ({ task }) => {
remarkPlugins={[remarkMath, remarkGfm]} remarkPlugins={[remarkMath, remarkGfm]}
rehypePlugins={[rehypeKatex]} rehypePlugins={[rehypeKatex]}
> >
{task.description} {markdownText}
</ReactMarkdown> </ReactMarkdown>
</div> </div>
@@ -1,6 +1,7 @@
import { create } from "zustand"; import { create } from "zustand";
import { User } from "../types/user"; import { User } from "../types/user";
import { getCurrentUser } from "../api/user"; import { getCurrentUser } from "../api/user";
import Cookies from "js-cookie";
interface UserState { interface UserState {
user: User | null; user: User | null;
@@ -22,6 +23,12 @@ const useUserStore = create<UserState>((set) => ({
clearUser: () => { clearUser: () => {
set({ user: null }); set({ user: null });
const cookies = Cookies.get();
Object.keys(cookies).forEach(cookieName => {
Cookies.remove(cookieName, { path: '/' });
Cookies.remove(cookieName);
});
}, },
})); }));