
Before we get started, give this bad boy a hover.
It all started 8 months ago...
I was re-designing my website and found this page with a bunch of amazing CSS hover effects for links.
# The Problem
I started looking into them and they all have one thing in common. They all require multiple elements to animate. This is unfortunate because I use
## Title
Some paragraph of text.
Another paragraph of text but this one has [a link](https://jonkuperman.com)Scroll horizontally to see the rest →I really wanted pretty links but I did not want to wrap every link I write in a span by hand.
So I did what I normally do, I tweeted out a question to the universe and hoped for a response!
As luck would have it, the CEO of Gatsby saw my Tweet and replied:
# Enter MDX
If you're not familiar, Anchor and then update my Markdown like so:
## Title
Some paragraph of text.
Another paragraph of text but this one has <Anchor title="a link" url="https://jonkuperman.com" />Scroll horizontally to see the rest →# Farewell, Remark
Unfortunately for me, I wasn't starting with a fresh Gatsby project. I've had this blog for a while and I'm using a lot of plugins that require Remark. The very format I'm trying to move away from!
Fortunately, the Gatsby docs are pretty great. This page on
# No small change
In the end, I ended up getting rid of a lot of Remark plugins. Partly this is due to the flexibility of MDX, but partly I was just using way too many plugins. Anyway the PR turned into a bit of a monster.

# Making the anchor
I'll probably play with this more but as soon as I finished the upgrade I made a new file utils/mdx.js and created an Anchor component.
import React from "react"
export function Anchor({ url, title }) {
return (
<span className="cl-effect-5" id="cl-effect-5">
<a href={url}>
<span data-hover={title}>{title}</span>
</a>
</span>
)
}Scroll horizontally to see the rest →Then, in layout.js I passed the component in as a shortcode.
import { Anchor } from "../utils/mdx"
const shortcodes = { Anchor }
;<MDXEmbedProvider>
<MDXProvider components={shortcodes}>{children}</MDXProvider>
</MDXEmbedProvider>Scroll horizontally to see the rest →Finally, in my blog posts like pretty-links.md I can just do
## Title
Some paragraph of text.
Another paragraph of text but this one has <Anchor title="a link" url="https://jonkuperman.com" />Scroll horizontally to see the rest →And now I have awesome links.