{%- if all_content | toc | safe -%}

Table of Contents

{{ all_content | toc | safe }}
{%- endif -%}