Replies: 1 comment 3 replies
-
Answer to questions from the PR:
Yes, with this implementation this is no longer possible.
For setting multiple roots at once?
Yes, this is CSS inspired, and should be changed to |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current system can be a bit confusing and restrictive, so @johannes-wolf and I have had some thoughts about taking inspiration from CSS styling. I want to layout my ideas for it here. Ideally we would want to use Typst's selectors. However you cannot "select" custom functions, but this will hopefully happen once custom types have been implemented.
The what
The idea is to have a simplified version of CSS with the bare minimum to make it work (no complicated bits) and modified to fit in with Typst. Ideally the default behaviour should be whatever the CSS default is unless it doesn't make sense to apply it.
type
: The type of element e.g.line
name
: The name of the elementclass
: Additional string(s) that identify or group the element. Can be user-defined or added by cetz. e.g."red lines"
,"fillable"
set-style
to be specific (could be renamed)Styling Input Format
selector
contains information about which elements should be selectedstyle
contains information about how to style the elementSelector fields
type
: A string that will match on the type of element"line"
name
: A string that will match on elements that have this user-defined nameid
class
: A string or a list of strings that will match on elements that have this class"fillable"
attribute
: Elements with the specified attributeschild
/parent
: A selector that will match on elements with a child or parent that matches the given selector.>
This again could be quite verbose
type
as its closest to the current method.The how
At the moment I see two possibilities:
.css
files to be importedTo conclude
This would be a BIG undertaking but honestly the current implementation is just to naïve. One concern I do have is by having something this big, what do we do when/if set rules come to custom functions? or custom elements?
Feel free to add suggestions or ask questions!
Beta Was this translation helpful? Give feedback.
All reactions