I believe you should use: '#test' => $node->get('body')->safe_value; At which point the data will be safely escaped, and therefore this is safe: {{ test.body.value|raw }}