diff --git a/daprdocs/layouts/partials/components/bindings.html b/daprdocs/layouts/partials/components/bindings.html index 92a93733b..04bf324e1 100644 --- a/daprdocs/layouts/partials/components/bindings.html +++ b/daprdocs/layouts/partials/components/bindings.html @@ -31,4 +31,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/componenttoc.html b/daprdocs/layouts/partials/components/componenttoc.html new file mode 100644 index 000000000..24440d713 --- /dev/null +++ b/daprdocs/layouts/partials/components/componenttoc.html @@ -0,0 +1,24 @@ +{{ $headers := findRE "(.|\n])+?" .Page.Content }} + {{ $has_headers := ge (len $headers) 1 }} + {{ if $has_headers }} +
+

Table of Contents

+ {{ range $headers }} + {{ $header := . }} + {{ range first 1 (findRE " + {{end}} + {{ $base := ($.Page.File.LogicalName) }} + {{ $anchorId := ($header | plainify | htmlEscape | urlize) }} + {{ $href := delimit (slice $base $anchorId) "#" | string }} + +
  • {{ $header | plainify | htmlEscape }}
  • +
    + {{ range seq $next_heading }} + + {{end}} + {{end}} + {{end}} + {{ end }} +
    + {{ end }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/configuration-stores.html b/daprdocs/layouts/partials/components/configuration-stores.html index bae0dafb9..d9d35b134 100644 --- a/daprdocs/layouts/partials/components/configuration-stores.html +++ b/daprdocs/layouts/partials/components/configuration-stores.html @@ -22,4 +22,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/middleware.html b/daprdocs/layouts/partials/components/middleware.html index 9f5355570..b1c59a2e1 100644 --- a/daprdocs/layouts/partials/components/middleware.html +++ b/daprdocs/layouts/partials/components/middleware.html @@ -22,4 +22,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/name-resolution.html b/daprdocs/layouts/partials/components/name-resolution.html index c54f1fb09..816873583 100644 --- a/daprdocs/layouts/partials/components/name-resolution.html +++ b/daprdocs/layouts/partials/components/name-resolution.html @@ -24,4 +24,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/pubsub.html b/daprdocs/layouts/partials/components/pubsub.html index caa3e7d4e..244a6f623 100644 --- a/daprdocs/layouts/partials/components/pubsub.html +++ b/daprdocs/layouts/partials/components/pubsub.html @@ -25,4 +25,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/secret-stores.html b/daprdocs/layouts/partials/components/secret-stores.html index 51505f691..18fe10234 100644 --- a/daprdocs/layouts/partials/components/secret-stores.html +++ b/daprdocs/layouts/partials/components/secret-stores.html @@ -36,4 +36,6 @@ {{ end }} {{ end }} - \ No newline at end of file + + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file diff --git a/daprdocs/layouts/partials/components/state-stores.html b/daprdocs/layouts/partials/components/state-stores.html index 58b3b4b87..6eed4ab85 100644 --- a/daprdocs/layouts/partials/components/state-stores.html +++ b/daprdocs/layouts/partials/components/state-stores.html @@ -36,4 +36,6 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ partial "components/componenttoc.html" . }} \ No newline at end of file