open links in new tab, closes #71

This commit is contained in:
Nathan Wang 2020-07-21 16:04:46 -07:00
parent bc743e14ff
commit 40bc285712
5 changed files with 28 additions and 1 deletions

View file

@ -55,6 +55,7 @@ export const plugins = [
// resolve: require.resolve('./src/mdx-plugins/table-of-contents.ts'),
// },
],
remarkPlugins: [require(`remark-external-links`)],
plugins: [
{
resolve: `gatsby-remark-autolink-headers`,

View file

@ -46,6 +46,7 @@
"recharts": "^1.8.5",
"rehype-react": "^6.0.0",
"remark": "^12.0.0",
"remark-external-links": "^6.1.0",
"styled-components": "^5.1.1",
"tailwindcss": "^1.4.6",
"tippy.js": "^6.2.4",

View file

@ -187,6 +187,8 @@ export function ProblemComponent(props: ProblemComponentProps) {
<a
href={problem.url}
className={problem.starred ? 'pl-1 sm:pl-2' : 'sm:pl-6'}
target="_blank"
rel="nofollow noopener noreferrer"
>
{problem.name}
</a>

View file

@ -139,7 +139,12 @@ export function Resource(props) {
</svg>
</Tooltip>
)}
<a href={url} className={props.starred ? 'pl-1 sm:pl-2' : 'sm:pl-6'}>
<a
href={url}
className={props.starred ? 'pl-1 sm:pl-2' : 'sm:pl-6'}
target="_blank"
rel="nofollow noopener noreferrer"
>
{props.title}
</a>
</div>

View file

@ -10283,6 +10283,13 @@ mdast-util-definitions@^1.2.0, mdast-util-definitions@^1.2.5:
dependencies:
unist-util-visit "^1.0.0"
mdast-util-definitions@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-2.0.1.tgz#2c931d8665a96670639f17f98e32c3afcfee25f3"
integrity sha512-Co+DQ6oZlUzvUR7JCpP249PcexxygiaKk9axJh+eRzHDZJk2julbIdKB4PXHVxdBuLzvJ1Izb+YDpj2deGMOuA==
dependencies:
unist-util-visit "^2.0.0"
mdast-util-definitions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-3.0.1.tgz#06af6c49865fc63d6d7d30125569e2f7ae3d0a86"
@ -13136,6 +13143,17 @@ remark-custom-blocks@^2.5.0:
dependencies:
space-separated-tokens "^1.1.5"
remark-external-links@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/remark-external-links/-/remark-external-links-6.1.0.tgz#1a545b3cf896eae00ec1732d90f595f75a329abe"
integrity sha512-dJr+vhe3wuh1+E9jltQ+efRMqtMDOOnfFkhtoArOmhnBcPQX6THttXMkc/H0kdnAvkXTk7f2QdOYm5qo/sGqdw==
dependencies:
extend "^3.0.0"
is-absolute-url "^3.0.0"
mdast-util-definitions "^2.0.0"
space-separated-tokens "^1.0.0"
unist-util-visit "^2.0.0"
remark-footnotes@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/remark-footnotes/-/remark-footnotes-1.0.0.tgz#9c7a97f9a89397858a50033373020b1ea2aad011"