How to align the outline entries and fill. plus more

Hi,
I wanted to typeset the old LaTeX (which i rewrote myself as well) of my uni in Typst, I have managed to get everything except one thing. I can’t get the outline to look like the original TeX output.

here is an example:

best I was able to produce is this:

// Outline setup
  #let docTableOfContents(body) = {
    set heading(numbering: "1.1")

    // set upper distance of level 1 heading
      show outline.entry.where( level: 1 ): set block(above: 24pt)
    
    // indents heading numbers level 2+
      set outline(indent: n => if n == 0 { 0em } else { 1em })
    // max depth
      set outline(depth: 4)
      
    outline()
    body
  }

// and call like this in main
#show: docTableOfContents 

which produces this:

(ignore that the lack of unnumbered sections and roman numeral pages, have not touched that yet)

the missing features of the TeX template are marked to be obvious. they are:

  • Bold level 1
  • aligned text/body for level 2 an higher
  • right aligned fill, which does not react to number width
  • no fill for level 1 entry

From what I can tell, the outline.entry function is what I want but I honestly don’t get how it operates from the examples in the typst docs.
If someone could help me a bit, I would be rather grateful.
The alignment on the left would be the most important, the rest is “ok” if it does not quite equate to the original

here is a link if you want to check out the whole thing:
FH-Wels-Thesis-Template

You may message me about things to improve, this is actually my first project in typst

I have a template that implements aligned fill, the code is here:

The actual fill and the right-alignment concern are neatly separated. the left alignment part of different level subsections is not handled, though…

Thanks, I will look at this tomorrow. I have also found the package outrageous, which can also align the fill on the right. I am checking if it can (hopefully) also align the body

yes, outrageuous and the code in my template actually are based on the same source. outrageuous is GPL licensed, so if that should worry you for your purposes, you can be sure that my code is based on the original source at typst-plugins/outex/src/outex.typ at b13b0e1bc30beba65ff19d029e2dad61239a2819 · EpicEricEE/typst-plugins · GitHub, which is MIT licensed. (I don’t attribute that source in my code because the actual code is heavily modified from that. Outrageous and outex offer an aligned “repeat” function while I separate the content and the alignment, so you then use plain Typst’s repeat to generate the actual fill.)