Is it possible to change the underbrace (& others) annotation to display math mode via a show-rule?

Hello,

Small question for the math underbrace, underline, etc. : is it possible to change the math mode for the annotation part to be display instead of inline?

Currently I have to write:

$ underbrace("cool math", display("note")) $

Is there a possible show-rule to omit the display part?

Something like this can be done:

#show math.underbrace: it => {
  let (body, annotation) = it.fields()
  if annotation.func() == math.display(none).func() { return it }
  return math.underbrace(body, math.display(annotation))
}

$ underbrace("cool math", "note") $

Note that the if check here looks more precise than it is: it’s actually just checking if annotation is styled (since that’s what you get with display()).