{{- $headings := findRE `]` .Content -}} {{- if gt (len $headings) 4 }}

CONTENTS

{{ .TableOfContents }}
{{- end -}}