~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain-support-agent

grain's support agent: triages mentions and reports, investigates bugs, proposes fixes

1 collaborator
0
0
main
24 lines · 876 B Raw History
import ReactMarkdown from "react-markdown"
import remarkGfm from "remark-gfm"

// Agent text, rendered. The agents read text written by strangers, so raw
// HTML is dropped and images are never rendered: an image URL in a reply
// would be fetched the moment the page opened, which is how a prompt
// injection would carry data out. Links stay, since nothing follows a link
// until it is clicked; react-markdown already refuses javascript: URLs.
export function Markdown({ children }: { children: string }) {
  return (
    <div className="markdown">
      <ReactMarkdown
        remarkPlugins={[remarkGfm]}
        skipHtml
        disallowedElements={["img"]}
        components={{
          a: ({ node: _node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer nofollow" />,
        }}
      >
        {children}
      </ReactMarkdown>
    </div>
  )
}