MDX - I should have done this sooner

I added support for mdx to my site, and it's made life much bettter.

As of this very post, I've added support for MDX to my site. It should make writing new content much easier for me. By removing lots of process that has proven unnecessary, I'll be able to get back to writing more here, an I'm very excited about that.

And it works great! Here's an example of a custom shortcode I wrote, called <Aside />:

These can be used to highlight important things.

And the relevant code for Aside:

1
const Aside = (props) => {
2
const theme = useTheme();
3
return (
4
<Box
5
borderLeft="8px solid"
6
padding="1rem 0 1rem 2rem"
7
borderColor={theme.colors.pink[400]}
8
backgroundColor={theme.colors.pink[50]}
9
margin="2rem 0 2rem 0rem"
10
{...props}
11
/>
12
);
13
};

Its use is fairly simple, too -

1
<Aside>These can be used to highlight important things.</Aside>

h/t

This is on the heels of last night's (now defunct) Reactadelphia Meetup, where a very talented developer named Prince gave a fantastic talk on MDX. I found it particularly inspiring -- it was that rare talk which had substance and motivation. I already had a pretty good grasp of what one might use MDX for in practice, but Prince made some great points about why MDX is such a game changer.

Mike Bifulco headshot

Subscribe to Tiny Improvements

A newsletter for product builders, startup founders, and indiehackers, who design with intention, and my thoughts on living a life you love in a busy world.

    Typically once a week, straight from me to you. 😘 Unsubscribe anytime.


    Get in touch to → Sponsor Tiny Improvements

    ***

    More great resources

    Articles about React.jsArticles about Remix.runArticles about Next.jsArticles for developersArticles for JavaScript developersArticles about CSSArticles about User Experience (UX)Articles about tools I useArticles about productivityBrowse all topics →
    © 2019-2023 Mike Bifulco

    Get in touch to → Sponsor Tiny Improvements

    Disclaimer: 👋🏽 Hi there. I work as a co-founder & CTO at Craftwork. These are my opinions, and not necessarily the views of my employer.
    Built with Next. Source code on GitHub.