-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "undoing" prose styles #205
Conversation
I can remember that we've tried some things equivalent in the past, without finding a proper way to do. Could you explain why this time it should work work? (except that this time @reinink did it, so it will obviously be better 😛) |
@mathieutu I can't remember for sure what our best effort was last time but I think the |
Yep! Can see that. There is not much differences with #73, except this |
@mathieutu Added you as a co-author on the PR for your original work on #73 🙏 Thanks man! 🍻 |
Oh! Thx, actually it was not the purpose at all. I'm just glad you guys have found the magic piece that we missed back then 😅! |
Would it be easier if we use |
Awesome, I really needed that |
@jakeprins It's available already via the |
If we use [modifier === 'DEFAULT' ? `:where(.${className})` : `:where(.${className}-${modifier})`]: configToCss( Using this method with @layer base {
:where(.prose) .unset {
all: unset;
}
:where(.prose) .prose-unset * {
all: unset;
}
} Plus, by doing this way, we can even add on utility classes with proper overrides without messing with |
Hey @phyrasaur, interesting idea, but wouldn't that also unset any base styles that you my have? For example: <style>
h1 { color: green; }
:where(.prose) .unset { all: unset; }
:where(.prose) .unset * { all: unset; }
:where(.prose) h1 { color: red; }
</style>
<div class="prose">
<div class="unset">
<h1>What color am I?</h1>
</div>
</div> In this situation, I would expect the This means that this approach would undo the Tailwind reset (Preflight), which isn't what we want either. |
@reinink Yeah, it won't respect the green color since it has lower specificity. Unless we add a class as a selector. I was thinking about how we can override |
😉 this should probably be added to the docs somewhere |
Yep we still haven't even written the release notes or upgrade guide for this, just didn't have time last week. Will be doing the docs this week. |
Noooooooo worries, sure you've got a billion things on the go currently! Out of curiosity will the official plugins be documented on the main Tailwind site at some point - or are they designed/planned to be kept separate on Github? |
@sjclark We hope to eventually have them all on the main website — starting with the typography docs, which were migrated last week: https://tailwindcss.com/docs/typography-plugin 🤟 |
Just a heads up - the |
Not sure if it's a bug or anyone else has the same issue, but using Hugo and I can't apply the "not-prose" or "max-w-none" classes, yet the prose class works without issues. |
Resolves #32.
This PR makes it possible to add markup within a
prose
block that ignores the styles thatprose
would normally add.For example:
The
not-prose
class ignores all styles except styles set directly on theprose
class, which arefont-size
,line-height
, andcolor
styles for the whole block.We could reset these back to the same values they are in preflight, but it's easy enough to do with a couple extra classes:
This means that by default, anything in a
not-prose
block will still be gray for example, and also match whatever the font size is set to for your prose block (which is different depending on whether you use justprose
, orprose prose-xl
, etc.)I think this is the right trade-off overall since it's easy to "fix" with those two extra classes, and if we automatically did that for you but you did want to match the font-size of the rest of your prose stuff you wouldn't easily be able to do it.
This feature depends newer CSS features like
:not({selector list})
and:where({selector list})
so it depends on the newtarget
mode being set tomodern
(which is the default).The whole plugin will be broken in older browsers because of this by default, so if you need to support Safari < 14 or Samsung Internet < 15, you should set
target
tolegacy
(which will remove thisnot-prose
feature completely, since it's not possible without these features):Will leave this open for a couple days in case anyone has important feedback but overall really impressed with how this works in practice 👍🏻