You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Sections state variable that tracks the first reveal of any section.#letratio-sections=state("ratio-sections", ())
/// Register a new section.#letregister-section(level: 1, body) =locate(loc=> {
ratio-sections.update(s=> {
letnew= ()
forsecins {
ifsec.end==noneandlevel<=sec.level {
sec.end=loc
}
new.push(sec)
}
new.push((body: body, level: level, start: loc, end: none))
new
})
})
/// Get the current section, regardless of level.#letcurrent-section=locate(loc=> {
letsections=ratio-sections.at(loc)
sections.last()
})
/// Get the current section of a given level. Returns the last seen section of that kind,/// or any higher up section if that was more recently seen.#letcurrent-section-of(level: 1) =locate(loc=> {
letsections=ratio-sections.at(loc)
forsecinsections.rev() {
ifsec.level<=level {
returnsec
}
}
none
})
Although I would love to only register them on their first "uncover" instead of the first subslide where they might still be hidden, but that is another matter.
The text was updated successfully, but these errors were encountered:
As proposed in #160, I created this issue to discuss the handling of variable depth sections.
The main challenge resides in the bookkeeping. In it's simplest form this would just be an array of entries.
For the Ratio theme I currently use the array approach, with the additions that section ends are also calculated (rather forcefully).
https://gitlab.com/ratio-case-os/typst/polylux-ratio/-/blob/main/src/sections.typ
To register headings on the fly I then use
Although I would love to only register them on their first "uncover" instead of the first subslide where they might still be hidden, but that is another matter.
The text was updated successfully, but these errors were encountered: