Implement mark to custom node


I have a custom node that has a size of 1 (as all custom nodes). But inside this node, I have a text to which I want to apply marks (like make it bold, italic, etc). Is there a way to do it? I’ve tried a lot of different ways to somehow handle it but it all not working.

Maybe, somebody faced the same problem and find a way to somehow do it?

Will be thankful for any help.

Nodes only have a size of 1 when they don’t have content—nodes that allow content will have a size of 2 + the content’s size, and thus allow you to address the nodes inside them.