Re: [csswg-drafts] [css-text] Add title case text transformation (#12526)

The `@text-transform` proposal would just need an `exception` descriptor for this. It would take a list of words as strings that should not be altered. Issue 9 about language-specific rules should be solved for that first. 

~~~~ css
/* Language Descriptor Variant: */
@text-transform --title-case {
  language: en;
  transform: capitalize;
  exception: 'the', 'a', 'an', 'in', 'on', 'of', 'off', 'out' 'at', 'for', 'and', 'or', 'with', 'without', 'to', 'too', 'not', /*…*/ ;
}
/* Language Selector Variant: */
@text-transform --title-case:lang(en) {
  transform: capitalize;
  exception: /* … */;
}
~~~~

This will not be able to enforce more complicated extra rules like “the final word is exempt from exceptions” or “articles are still capitalized before singular nouns”. 

PS: The proposal does not require initial double hyphens but supports them. 


-- 
GitHub Notification of comment by Crissov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12526#issuecomment-3120403610 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 25 July 2025 21:22:19 UTC