feat(markdown): Add target and rel attributes to anchor tags for improved security and forcing open in a new window
This commit is contained in:
parent
9f58910254
commit
ea6f71d406
2 changed files with 5 additions and 1 deletions
|
|
@ -149,6 +149,11 @@ const MarkdownRenderer = ({
|
||||||
pre: {
|
pre: {
|
||||||
component: ({ children }) => children,
|
component: ({ children }) => children,
|
||||||
},
|
},
|
||||||
|
a: {
|
||||||
|
component: (props) => (
|
||||||
|
<a {...props} target='_blank' rel='noopener noreferrer' />
|
||||||
|
),
|
||||||
|
},
|
||||||
// Prevent rendering of certain HTML elements for security
|
// Prevent rendering of certain HTML elements for security
|
||||||
iframe: () => null, // Don't render iframes
|
iframe: () => null, // Don't render iframes
|
||||||
script: () => null, // Don't render scripts
|
script: () => null, // Don't render scripts
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ interface ThinkBoxProps {
|
||||||
|
|
||||||
const ThinkBox = ({ content, expanded, onToggle }: ThinkBoxProps) => {
|
const ThinkBox = ({ content, expanded, onToggle }: ThinkBoxProps) => {
|
||||||
// Don't render anything if content is empty
|
// Don't render anything if content is empty
|
||||||
console.log('ThinkBox content:', content);
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue