tailwindcss-typography: prose color classes are not working.
I have applied prose prose-blue on my content. However it doesn’t render the links as blue.
See here my blog.
This is my code rendering the markdown
export default function PostBody({ content }) {
return (
<div
className="max-w-4xl mx-auto prose prose-blue"
dangerouslySetInnerHTML={{ __html: content }}
/>
);
}
In the html it shows as.
<div class="">
<p>My blog content including <a href="https://github.com">some link</a>.</p>
</div>
My tailwind.config.js looks as
module.exports = {
.......
plugins: [require("@tailwindcss/typography")],
};
Is this a bug? Did I miss something?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 15 (4 by maintainers)
Hey! Thank you for your bug report! Much appreciated! 🙏
There are multiple issues going on in this thread. I will address some of them and close the issue afterwards. If you still have certain issues after you read this, feel free to open a new issues + reproduction case. Preferably using https://play.tailwindcss.com
If your
.prosecss classes are empty:Make sure that if you are using the purge option, that you are either making sure that all the prose related classes exists in the files you listed in the
purge: []config. If your prose related content is coming from a database and doesn’t exist in your actual code. Make sure to safelist the prose related classes. See: https://tailwindcss.com/docs/optimizing-for-production#purge-css-optionsUsing colors
If you are using
prose-{color}related classes. These only apply for links (a) and code tags inside of anchors (a code). We use the600variant for each color. This means thatblue.600orred.600should exist.A bunch of styles disappear
Make sure that if you want to change only specific parts of your typography styles that you put them inside the
theme: { extend: { /* ... */ } }section so that you are extending those parts only, instead of throwing everything away.Trying to experiment with Tailwind on my own website for fun, I stumbled upon the same issue. I was trying to create a custom color
primary, and useprose-primaryto see how it’d look.Here’s a screencast:
https://user-images.githubusercontent.com/1311607/103542519-57838080-4e9d-11eb-9cca-b13cfa041945.mp4
sry for the slow compilation time, changing the tailwind config always takes some time
As a reproduction, you can use the following branch: https://github.com/martpie/martpie.io/tree/tailwind-repro
localhost:3000/thoughts/i-still-dont-buy-graphqltailwind.config.js