gatsby-remark-dictionary
Version:
Create a dictionary of word and phrases to be converted to highlighted values and links. define once and all phrases will be converted during build time.
15 lines (12 loc) • 325 B
JavaScript
import React from 'react';
import { Link as GatsbyLink } from 'gatsby';
import isAbsoluteUrl from 'is-absolute-url';
const Link = ({ to, ...props }) =>
isAbsoluteUrl(to) ? (
<a href={to} {...props}>
{props.children}
</a>
) : (
<GatsbyLink to={to} {...props} />
);
export default Link;