How to draw a decorative frame (rect with concave corners) around text?

Thank you; that’s very helpful and informative!

The only thing I’d like to be different is for the frame to have the same full width as other text blocks, without having to manually specifying a width. Here’s an example of what I mean (screenshot of output from this project: Typst ):

As you can see, on the left the frame starts at the same x-coordinate as the text, but on the right the width is different — I guess I could measure the earlier blocks’ width and specify that, but wondering if there’s a way to specify the inner width (of the text) by subtracting the relevant amounts from the “current” width, then measure the height, then draw the frame with the relevant width and height.

(About the earlier question: true, I said “trying” but included no code; I should have said I’m exploring whether it’s feasible to use Typst for this use-case; I’m still currently on page 3, and all I had for this specific issue was a #rect with rounded corners, which I thought wasn’t worth sharing. There are other issues I’m encountering like Paragraph indentation seems to be buggy which may mean I have to give up on Typst, so it’s still in the early stages of exploration. Also the screenshot tool I used to take a screenshot of the original PDF didn’t allow redacting with black bars which would have been better, but only allowed blurring, which I agree is a weird choice! There is actually something relevant about the shape, namely placing the last line indented a bit to fit into the frame, but I’m willing to forgo that.)