Skip to content

Commit

Permalink
open links in new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
danerieber committed May 26, 2024
1 parent ea7a913 commit 98bf7fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions components/ChatMessageElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Username from "./Username";
import remarkGemoji from "remark-gemoji";
import { Verified } from "@mui/icons-material";
import { Tooltip } from "@nextui-org/tooltip";
import rehypeExternalLinks from "rehype-external-links";

export default function ChatMessageElement({
icon,
Expand Down Expand Up @@ -83,6 +84,7 @@ export default function ChatMessageElement({
<Markdown
className={clsx("text-wrap break-words", !showUsername && "pl-5")}
remarkPlugins={[remarkGfm, remarkBreaks, remarkGemoji]}
rehypePlugins={[[rehypeExternalLinks, { target: "_blank" }]]}
components={{
img(props) {
const { src, alt } = props;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^9.0.1",
"rehype-external-links": "^3.0.0",
"remark-breaks": "^4.0.0",
"remark-gemoji": "^8.0.0",
"remark-gfm": "^4.0.0",
Expand Down

0 comments on commit 98bf7fb

Please sign in to comment.