https://support.apple.com/en-ie/guide/mac-help/mchlp1341/mac
So I guess a comparison between TextEdit and Pages doesn't make too much maybe, they're really different things.
On the other side of the fence, WordPad initially came with source code as well, and was essentially a demo app for the rich edit control as well as the criminally underused text converters[1].