mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-18 04:54:34 +01:00
really really open markdown links outside (#1002)
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user