How to modify the styling of outline entries?

Since I just so happened to have noticed this unanswered post, here’s a possible answer.

This code only addresses the points you have mentioned:

Code
#set heading(numbering: "1.1")
#set repeat(gap: 0.5em)

// Unrecommended because this highlights too much
// #show link: highlight.with(fill: none, stroke: red)

#show outline.entry: it => link(
  it.element.location(),
  it.indented(
    it.prefix(),
    {
      highlight(fill: none, stroke: red, it.body())
      box(width: 1fr, repeat[.])
      it.page()
    }
  )
)

// Order seems to matter here
#show outline.entry: set block(spacing: 2em)
#show outline.entry.where(level: 1): set block(above: 3em)

#outline()
Output

For emboldening the first-level entries and right-aligning the dotting, refer to How to align the outline entries and fill. plus more - #12 by Astrusia.

3 Likes