File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9696 "react-inlinesvg" : " ^3.0.3" ,
9797 "react-markdown" : " ^10.1.0" ,
9898 "react-syntax-highlighter" : " ^15.6.1" ,
99+ "rehype-external-links" : " ^3.0.0" ,
99100 "rehype-raw" : " ^7.0.0" ,
100101 "remark-definition-list" : " ^2.0.0" ,
101102 "remark-gfm" : " ^4.0.1" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import ReactMarkdown from "react-markdown";
33import { Prism as SyntaxHighlighter } from "react-syntax-highlighter" ;
44// @ts -ignore: No declaration file for module (TODO: should be @ts-expect-error but GUI elements is used inside project with `noImplicitAny=false`)
55import remarkTypograf from "@mavrin/remark-typograf" ;
6+ import rehypeExternalLinks from "rehype-external-links" ;
67import rehypeRaw from "rehype-raw" ;
78import { remarkDefinitionList } from "remark-definition-list" ;
89import remarkGfm from "remark-gfm" ;
@@ -118,6 +119,13 @@ export const Markdown = ({
118119 htmlContentBlockProps,
119120 ...otherProps
120121} : MarkdownProps ) => {
122+ const configHtmlExternalLinks = {
123+ rel : [ "nofollow" ] ,
124+ target : linkTargetName ,
125+ } ;
126+
127+ configDefault . rehypePlugins = configDefault . rehypePlugins . concat ( [ [ rehypeExternalLinks , configHtmlExternalLinks ] ] ) ;
128+
121129 const configHtml = allowHtml
122130 ? {
123131 rehypePlugins : [ ...configDefault . rehypePlugins ] . concat ( [ rehypeRaw ] ) ,
@@ -155,7 +163,6 @@ export const Markdown = ({
155163 } }
156164 children = { String ( children ) . replace ( / \n $ / , "" ) }
157165 language = { match [ 1 ] }
158- target = { linkTargetName }
159166 />
160167 ) : (
161168 < code { ...rest } className = { className } >
Original file line number Diff line number Diff line change @@ -6549,6 +6549,11 @@ invariant@^2.2.3:
65496549 dependencies:
65506550 loose-envify "^1.0.0"
65516551
6552+ is-absolute-url@^4.0.0:
6553+ version "4.0.1"
6554+ resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-4.0.1.tgz#16e4d487d4fded05cfe0685e53ec86804a5e94dc"
6555+ integrity sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==
6556+
65526557is-alphabetical@^1.0.0:
65536558 version "1.0.4"
65546559 resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz#9e7d6b94916be22153745d184c298cbf986a686d"
@@ -9624,6 +9629,18 @@ regjsparser@^0.12.0:
96249629 dependencies:
96259630 jsesc "~3.0.2"
96269631
9632+ rehype-external-links@^3.0.0:
9633+ version "3.0.0"
9634+ resolved "https://registry.yarnpkg.com/rehype-external-links/-/rehype-external-links-3.0.0.tgz#2b28b5cda1932f83f045b6f80a3e1b15f168c6f6"
9635+ integrity sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==
9636+ dependencies:
9637+ "@types/hast" "^3.0.0"
9638+ "@ungap/structured-clone" "^1.0.0"
9639+ hast-util-is-element "^3.0.0"
9640+ is-absolute-url "^4.0.0"
9641+ space-separated-tokens "^2.0.0"
9642+ unist-util-visit "^5.0.0"
9643+
96279644rehype-minify-whitespace@^6.0.0:
96289645 version "6.0.2"
96299646 resolved "https://registry.yarnpkg.com/rehype-minify-whitespace/-/rehype-minify-whitespace-6.0.2.tgz#7dd234ce0775656ce6b6b0aad0a6093de29b2278"
You can’t perform that action at this time.
0 commit comments