typst-0.1.0.0: test/typ/compiler/return-02.typ
// Test return with joining and content.
// Ref: true
#let f(text, caption: none) = {
text
if caption == none [\.#return]
[, ]
emph(caption)
[\.]
}
#f(caption: [with caption])[My figure]
#f[My other figure]