improve: render description with markdown

This commit is contained in:
guanghechen 2024-07-10 16:23:41 +08:00
parent 85d144a1e9
commit e775b6ea5e
2 changed files with 6 additions and 1 deletions

View file

@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import Image from "next/image"; import Image from "next/image";
import { ReactMarkdown } from "@/components/Markdown";
interface ContextItemProps { interface ContextItemProps {
item: { item: {
@ -28,7 +29,9 @@ const ContextItem: React.FC<ContextItemProps> = ({ item }) => {
className="my-2 rounded" className="my-2 rounded"
/> />
)} )}
<p className="text-black dark:text-white">{item.description}</p> <div className="text-black dark:text-white">
<ReactMarkdown text={item.description} />
</div>
<a href={item.url} target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:underline"> <a href={item.url} target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:underline">
Read more Read more
</a> </a>

View file

@ -1,3 +1,5 @@
"use client";
export * from "./ReactMarkdown"; export * from "./ReactMarkdown";
export * from "./context"; export * from "./context";
export * from "./parser"; export * from "./parser";