How to style selected level in bullet list?

Hi all, I would like to make first level in bullet list bold. Is there a way how to set this with a set or show rule? Thanks!

Hi @Vaclav_Bocan ,

There is an open issue for that:

There is a workaround mentioned in the thread, which I haven’t tried:

let depth = state("depth", 0)

show enum.item: i => {
  depth.update(d => d + 1)
  i
  depth.update(d => d - 1)
}
show enum: l => {
  context if depth.get() == 1 {
    // Do something if depth == 1
  }
  context if depth.get() == 2 {
    // Do something if depth == 2
  }
  l
}

show list.item: i => {
  depth.update(d => d + 1)
  i
  depth.update(d => d - 1)
}
show list: l => {
  context if depth.get() == 1 {
    // Same idea here
  }
  l
}
2 Likes

As long as you only want to change the first level, you can use the nested rules similar to the suggestion in the issue that @vmartel08 shared. The first show-set rule will make all list items bold, and the second show-set rule will override the first rule for all nested list items.

#show list.item: set text(weight: "bold")
#show list: it => {
  show list.item: set text(weight: "regular")
  it
}
3 Likes

Thank you for the link. I hope it gets implemented soon! I will go with Janek’s solution for now as I need to edit only the first level now, but will try the one you shared if I need to adjust deeper levels as well.

Thank you, I’ll go with your suggestion for now. Hope the issue will get properly addressed sooo.

Hi @Vaclav_Bocan, don’t forget to tick :ballot_box_with_check: one of the responses if you got a satisfying answer. The answer you choose should usually be the response that you found most correct/helpful/comprehensive for the question you asked. Thanks!

Hi SillyFreak, I did not select an answer to be a solution, since those are temporary workarounds and proper solution still needs to be implemented by the developers. I’m looking forward having this feature in typst soon!

2 Likes