pr_01m47d15m3e54sn21z27rpy5n9/apps/web/app/components/markdown.tsx

31 lines848 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

API and MCP server, Rust identity service, registration, site redesign1import ReactMarkdown from "react-markdown";
2import { Link } from "react-router";
3import remarkGfm from "remark-gfm";
4
5/**
6 * Renders markdown from repositories, briefs and docs. Raw HTML in the
7 * source is not rendered, so untrusted content is safe to pass in.
8 */
9export function Markdown({ source }: { source: string }) {
10 return (
11 <div className="prose">
12 <ReactMarkdown
13 remarkPlugins={[remarkGfm]}
14 components={{
15 a({ href, children }) {
16 // In-site links navigate on the client.
17 return href?.startsWith("/") ? (
18 <Link to={href}>{children}</Link>
19 ) : (
20 <a href={href} rel="noreferrer nofollow">
21 {children}
22 </a>
23 );
24 },
25 }}
26 >
27 {source}
28 </ReactMarkdown>
29 </div>
30 );
31}