Merge pull request #20 from danny-avila/override-links

feat: links open in new tab
This commit is contained in:
Danny Avila 2023-03-10 09:45:52 -05:00 committed by GitHub
commit 57d3025717
2 changed files with 28 additions and 1 deletions

View file

@ -0,0 +1,15 @@
import React from 'react';
export default function TabLink(a) {
return (
<a
href={a.href}
title={a.title}
className={a.className}
target="_blank"
rel="noopener noreferrer"
>
{a.children}
</a>
);
}

View file

@ -2,10 +2,22 @@ import React from 'react';
import Markdown from 'markdown-to-jsx';
import Embed from './Embed';
import Highlight from './Highlight';
import TabLink from './TabLink';
import regexSplit from '~/utils/regexSplit';
import { wrapperRegex } from '~/utils';
const { codeRegex, inLineRegex, markupRegex, languageMatch, newLineMatch } = wrapperRegex;
const mdOptions = { wrapper: React.Fragment, forceWrapper: true };
const mdOptions = {
wrapper: React.Fragment,
forceWrapper: true,
overrides: {
a: {
component: TabLink,
// props: {
// className: 'foo'
// }
}
}
};
const inLineWrap = (parts) => {
let previousElement = null;