How can I place text in the same line on the right side unless there is no space left

Hi @NNS,

you are looking for a word joiner sym.wj.

#let rhs(body) = {
  box()
  h(1fr) 
  sym.wj
  box(body)
}

short line #rhs[-- content on the right]

external box long text looks good #rhs[-- content on the right]

7 Likes