Skip to content
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

Add level field to bullet list items for easier format and style minipulation #4520

Open
jeremyforan opened this issue Jul 8, 2024 · 4 comments
Labels
feature request New feature or request model Related to structure and semantics. styling About set and show rules or style properties

Comments

@jeremyforan
Copy link
Sponsor

Description

Having the ability to easily format nested items would allow for improved styling. The current method is not intuitive:

show list: it => {
  show list: set text(size: 12pt)
  it
}

A more intuitive version may be:

show list.item.where(level: 1): it => [
    #set text(size: 24pt)
    *#it*
  ]
show list.item.where(level: 2): it => [
    #set text(size: 12pt)
    #it    
  ]
show list.item.where(level: 3): it => [
    #set text(size: 8pt)
    #it    
  ]

Use Case

I would like to create functions for specific types of list.
For example a project deliverables list, or a list of software systems and their subsystems.

@jeremyforan jeremyforan added the feature request New feature or request label Jul 8, 2024
@bluebear94
Copy link
Contributor

list already has a depth field, but it’s a ghost field (not accessible to the user). enum doesn’t have depth, but it has a parents field (storing the numbering of the parent enums rather than the number of nesting levels), which is also a ghost field.

I don’t think we want these fields to be explicitly set from Typst. Perhaps we can expose a depth method on both of these elements.

@jeremyforan
Copy link
Sponsor Author

Can you elaborate on why it wouldn't be good to make the field public? Would it conflict with a design standard or add some technical complexity?

@bluebear94
Copy link
Contributor

Just a hunch at this time, but I’m mostly worried about the folding of these values – both ListItem::depth and EnumItem::parents are declared as #[fold] fields, meaning that setting these would add to the values in the style chain rather than overriding them entirely.

@bluebear94
Copy link
Contributor

It might also be useful to have the depth property account for different types of lists, so that a list nested inside an enum would have a depth of 2.

@laurmaedje laurmaedje added styling About set and show rules or style properties model Related to structure and semantics. labels Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request model Related to structure and semantics. styling About set and show rules or style properties
Projects
None yet
Development

No branches or pull requests

3 participants