diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index bfa06da7..4ecef023 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -1,9 +1,22 @@ {{ $context := . }} {{ $defaults := dict "id" $context.Anchor }} +{{ $max := 0 }} {{ $attrs := merge .Attributes $defaults }} - +{{ range $k, $v := .Page.Fragments.HeadingsMap }} + {{ if gt $v.Level $max }} + {{ $max = $v.Level }} + {{ end }} +{{ end }} + +{{ $level := $context.Level }} + +{{ if and $max (lt $max 6) }} + {{ $level = add $context.Level (sub 6 $max) }} +{{ end }} + + {{ .Text }} - +