aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Wang2020-07-21 16:04:46 -0700
committerNathan Wang2020-07-21 16:04:53 -0700
commit40bc285712ea5c698e91e6a003fdf5ef4f11e5be (patch)
tree65767e88c27469b2cdac31cc327764d7bc8cfe11
parentbc743e14ff582ce3cdfefc93ff0196b92dc0c96e (diff)
open links in new tab, closes #71
-rw-r--r--gatsby-config.ts1
-rw-r--r--package.json1
-rw-r--r--src/components/markdown/ProblemsList/ProblemsList.tsx2
-rw-r--r--src/components/markdown/ResourcesList.tsx7
-rw-r--r--yarn.lock18
5 files changed, 28 insertions, 1 deletions
diff --git a/gatsby-config.ts b/gatsby-config.ts
index da0dcff..3090c07 100644
--- a/gatsby-config.ts
+++ b/gatsby-config.ts
@@ -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`,
diff --git a/package.json b/package.json
index d1cd95f..f08df9a 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/src/components/markdown/ProblemsList/ProblemsList.tsx b/src/components/markdown/ProblemsList/ProblemsList.tsx
index 2e25881..9a8b119 100644
--- a/src/components/markdown/ProblemsList/ProblemsList.tsx
+++ b/src/components/markdown/ProblemsList/ProblemsList.tsx
@@ -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>
diff --git a/src/components/markdown/ResourcesList.tsx b/src/components/markdown/ResourcesList.tsx
index 48bb754..1bbc0c0 100644
--- a/src/components/markdown/ResourcesList.tsx
+++ b/src/components/markdown/ResourcesList.tsx
@@ -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>
diff --git a/yarn.lock b/yarn.lock
index 5064c0e..4d702d5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"