We spend a lot of time obsessing over how things are designed, and rendered on our website . This year, we wanted to go all-in with writing the most optimized and beautiful code for our website and blog to make it easy for our readers to read the content. To do this, we moved from the default Tailwind Typography’s prose
class to showcase our code blocks to Rehype .
Rehype is amazing to render code blocks. It allows us to be able to customize almost every aspect of the code block on our blog. But as soon as we implemented Rehype, we hit a roadblock. That was that the Prose class from Tailwind Typography was interfering with the Rehype styles code blocks. Making it look worse.
While we are well-aware of Tailwind and its plugins, one thing we couldn’t figure out was a way to disable prose
for certain blocks of content. After hours of trial and error, here’s what worked for us:
Disable prose
for code
and pre
tags on TailwindCSS
The best way to disable prose
class for certain code blocks for your blog is to disable it under the tailwind.config.js
. In the config file, extend the following code:
This did the trick for us. Now, what you see above is the codeblock using rehype rather than getting overridden by Tailwind CSS prose
class. Have something to say? Hit us up on Twitter @getFeatureOS
References
Of course, we couldn’t have done this without the help of the community. Here are some reference links:
tailwindlabs/tailwindcss-typography ↗
tailwindlabs/tailwindcss-typography ↗
https://tailwindcss.com/docs/typography-plugin#customizing-the-css
Subscribe to our newsletter
Get the latest updates from our team delivered directly to your inbox.
Related Posts
How to build a Gmail like multi row checkbox selection in your NextJS/React app
Guide to building a multiple row checkbox selection in your ReactJS or NextJS app similar to Gmail.
How we migrated our Rails 6 app from AWS RDS to Planetscale
The story of how we ran away from AWS RDS to Planetscale for our Rails 6 app. Sort of a love letter to Planetscale.
How we migrated to Radix UI on NextJS and Tailwind
This is a guide of how we migrated to Radix UI on NextJS and Tailwind CSS. Our journey and experience towards moving to Radix UI.