Skip to content

Commit

Permalink
Merge pull request #1817 from newrelic/1751_display_external_links_in…
Browse files Browse the repository at this point in the history
…_quickstart_markdown

chore: show icon for links in markdown quickstart descriptions (#1751)
  • Loading branch information
aswanson-nr authored Oct 25, 2021
2 parents fcf54e7 + f4a25e7 commit 626b38c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ import PropTypes from 'prop-types';
import { css } from '@emotion/react';
import ReactMarkdown from 'react-markdown';

import { Link } from '@newrelic/gatsby-theme-newrelic';

const aTagToLink = ({
// eslint-disable-next-line no-unused-vars
node,
...props
}) => {
return (
<Link
to={props.href}
css={css`
text-decoration: none;
`}
displayExternalIcon
>
{props.children}
</Link>
);
};

const Markdown = ({ className, ...props }) => (
<ReactMarkdown
{...props}
Expand All @@ -12,6 +32,9 @@ const Markdown = ({ className, ...props }) => (
margin-top: 0;
}
`}
components={{
a: aTagToLink,
}}
/>
);

Expand Down

0 comments on commit 626b38c

Please sign in to comment.