Strip html tags in preprocess hook
Then better apply strip_tags() on the processed text $node-&gt;body-&gt;processed. You might also want to apply Html::decodeEntities(). Still take care you configure the text format restrictively, because outputting the text in a non standard way can be a security risk increasing with features you allow. And you don't get security updates for custom code.