Back to Materialize

Yaml Sections.Skill

doc/user/layouts/shortcodes/yaml-sections.skill.md

123700 B
Original Source

{{- /* Skill output: yaml-sections renders sections with markdown headings */ -}} {{- $dataPath := .Get "data" -}} {{- $headingField := .Get "heading-field" | default "title" -}} {{- $headingLevel := .Get "heading-level" | default "3" | int -}} {{- $headingPrefix := "" -}} {{- range seq $headingLevel -}} {{- $headingPrefix = printf "%s#" $headingPrefix -}} {{- end -}} {{- $parts := split $dataPath "/" -}} {{- $data := index site.Data (index $parts 0) -}} {{- range $i, $key := after 1 $parts -}} {{- $data = index $data $key -}} {{- end -}} {{ range $section := $data }} {{ $heading := index $section $headingField }} {{ $headingPrefix }} {{ $heading }}

{{ $section.description }} {{ end -}}