How can I create different outline entry rules for different outline targets?

I have the following rule for my table of content:

  #show outline.entry.where(level: 1): entry => {
    v(1.1em, weak: true)
    strong(entry)
  }

Now when I add a #outline(target: figure) I’d like to change the look to remove these adjustments. But #show outline.where(target: figure).entry.where(level: 1) is not allowed by the compiler.

How can I change the look of figure entries?

1 Like

Since

#show outline.where(target: heading): it => {
  show outline.entry.where(level: 1): set spacing(above: 1.1em)
  show outline.entry.where(level: 1): strong
  it
}

doesn’t work, nor does

#show outline.entry.where(level: 1, target: heading): set spacing(above: 1.1em)
#show outline.entry.where(level: 1, target: heading): strong

I’d say that it’s a missing feature, since figure.caption inherits 5 fields from figure, so a manual approach is required:

#show outline.entry.where(level: 1): it => {
  if it.element.func() != heading { return it }
  set block(above: 1.1em)
  // set text(weight: "bold")
  show: strong
  link(it.element.location(), it.indented(it.prefix(), it.inner()))
}