-
Notifications
You must be signed in to change notification settings - Fork 517
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
feat(css-syntax): render more constituents #11003
Conversation
The current code only considers css types as constituents. However, e.g. `margin` has a property as constituent. This change allows us to render constituents of type property.
@wbamberg I'd value your input a lot since you're the expert here 🙏 |
@fiji-flo You might want to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but didn't test locally.
|
Btw I guess this is a |
It's good to handle constituent properties in formal syntax. But rather than expanding out the syntax for properties I think it would be better to link to the property's own page, which lists its own formal syntax. This is in line with what we do for data types like Expanding out property syntax like this might make lots of syntaxes very long and repetitive. Also I think linking helps to emphasise to readers that this is the same as the property syntax (that essentially the shorthand is defined in terms of its longhands). |
@wbamberg I thought about just linking and that should not be my decision to make. Just as a explanation why I went with expanding: I saw this especially with the shorthand properties like |
If I were trying to make the call I'd love to know lots of places where this would make a difference, and how big a difference it would make, and especially whether there would be many places where we'd get pathologically huge formal syntax. I could imagine It's one of these tricky things where the optimal choice for 95% of cases ends up being pathological for the remaining 5%, and the optimal choice for the 5% is worse for the 95%. Maybe it would be worth thinking about suppressing inline expansion in a few ad hoc cases, as we already do for
The pretty-printing and syntax highlighting added in #4656 was really just an incremental improvement over what was there before, and I think there's definitely scope to present this in a more interactive way. ISTR css-tree used to have a thing where you could explore syntax by clicking on the components and it would expand to show you the details of that component. But getting it all right, and usable by people, feels like a project. I think I experimented with using some |
@wbamberg finally the diff https://static.fiji-flo.de/ |
Thanks, that's a very usable diff. I think it looks great. I'm totally +1 on this. |
I think expanding is the right way to go. Thanks. 👍 That said, if a value reads |
Yes, I had that thought too but forgot to mention it, thanks Estelle. Linking as well as expanding would be even better. |
I linked them, but the whole |
@wbamberg @estelle are you okay with the latest change (how the links look). I also found other issues like the duplicate on https://developer.mozilla.org/en-US/docs/Web/CSS/calc-sum#formal_syntax which I will address in a follow up. |
Yes. LGTM. Thank you! |
Yes, looks good to me, too. Thanks! |
Summary
The current code only considers css types as constituents. However, e.g.
margin
has a property as constituent.This change allows us to render constituents of type property.
Screenshots
Before
After
How did you test this change?
Locally
Changed:
http://localhost:3000/en-US/docs/Web/CSS/margin#formal_syntax
http://localhost:3000/en-US/docs/Web/CSS/padding#formal_syntax
Did not change:
http://localhost:3000/en-US/docs/Web/CSS/gradient#formal_syntax