I am making pages with HTML formatted articles and want to add a "Expand / Hide" script after 1,000 characters.

How can I insert the code so it does not end up inside an HTML <> tag?

For example, I would like to have the code appear like:

<p>... blah blah blah [insert Expand/Hide Link/Div] blah blah blah</p>

But prevent it from doing this, like appearing inside a hyperlink or inside any kind of <> tag?:

<p>... blah <a href="[insert Expand/Hide Link/Div]">link</a> blah </p>