It’s complicated.
Revit has the text.
And it has the formatted text.
The formatted text isn’t some nice set of codes like the good old days and WordPerfect 5.1. It is a bunch of text ranges and lots of get and set methods.
I’m surprised any text node works.
For you’re reading enjoyment:
https://forum.dynamobim.com/t/replace-specific-text-in-text-note-maintain-list-numbering/59059