How to merge Adjacent Blocks, or Adjacent Show Rule Targets?

I am trying to achieve something like this. One page with a fancy box around both columns and a central border between them.
Everything that goes off the page gets a similar fancy box so you can tell it goes with the original content.

#set page(width: 300pt, height: 300pt, margin: 10pt, columns: 2)
#figure(placement:top,scope:"parent",[
  #text(size:18pt, "TITLE")
  #place(top+center, dy:40pt, line(length: 80%, angle:90deg, stroke:red))  
])
#place(top+left, float:false, [
  #box(stroke:red, width:280pt, height: 240pt, outset: 4pt)
])
#let carr = ()
#for idx in range(10) {
  carr.push(block(width:100%, height:100pt, breakable: false, stroke:blue,[Content #idx]))
}

#for c in carr.slice(0,4) {
  c
}
#block(width: 100%, stroke:red, outset: 4pt, [
#for c in carr.slice(4) {
  c
}
])

I have figured out how to apply styling to just the items that are on the following pages using a show rule, but I would like to merge the blocks so you get a consistent border.

#set page(width: 300pt, height: 300pt, margin: 20pt, columns: 2)
//#let p = counter("_page")
//#context p.update(here().position().page)
#show label("_c"): it => {
//      if(it.location().page() != p.get().at(0)){
      box(stroke:red+2pt, outset:12pt, it)
//    } else {
//      box(it)
//    }
}
#let content_array = (box(width:100pt, [Value]),)*3
#for (idx,c) in content_array.enumerate() {
  block([#c #label("_c")])
}

If I could place a single block around all the content with labels that meet the condition, that would work. Because it’s done by for loop, I know the content that meets the condition will always be sequential, with nothing else in-between.

Hey @Tetragramm, welcome to the forum! I’ve changed your question post’s title to better fit our guidelines: How to post in the Questions category

For future posts, please make sure your title is a question you’d ask to a friend about Typst. :wink:

1 Like