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

Table of Contents

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