The passed string-like object is always flattened to an unstyled string during the standard parsing. It would be nicer if this method supported StyledText.
An acceptable workaround is to add a variant of the function that omits some of the steps that make it hard to support StyledText and have only that version support StyledText.