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

Table of Contents

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