really really open markdown links outside (#1002)

This commit is contained in:
marcelle
2025-01-31 21:02:38 -05:00
committed by GitHub
parent 44bf57b397
commit 0ca4cf01c7

View File

@@ -6,6 +6,10 @@ import { oneLight } from 'react-syntax-highlighter/dist/cjs/styles/prism';
import { Check, Copy } from './icons';
import { visit } from 'unist-util-visit';
const UrlTransform = {
a: ({ node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer" />,
};
function rehypeinlineCodeProperty() {
return function (tree) {
if (!tree) return;
@@ -84,6 +88,7 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon
prose-code:break-all prose-code:whitespace-pre-wrap
${className}`}
components={{
...UrlTransform,
code({ node, className, children, inlinecode, ...props }) {
const match = /language-(\w+)/.exec(className || 'language-text');
return inlinecode == 'false' && match ? (