mirror of https://github.com/dapr/docs.git
Add a components TOC partial because rendering order prevents the markdown renderer .TableOfContents from working
This commit is contained in:
parent
661bc71a27
commit
2437bc17ab
|
@ -31,4 +31,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -0,0 +1,24 @@
|
|||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Page.Content }}
|
||||
{{ $has_headers := ge (len $headers) 1 }}
|
||||
{{ if $has_headers }}
|
||||
<div class="table-of-contents toc bd-callout">
|
||||
<h4 class="text-muted">Table of Contents</h4>
|
||||
{{ range $headers }}
|
||||
{{ $header := . }}
|
||||
{{ range first 1 (findRE "<h[1-6]" $header 1) }} {{ range findRE "[1-6]" . 1 }} {{ $next_heading :=(int .) }} {{
|
||||
range seq $next_heading }} <ul class="toc-h{{ . }}">
|
||||
{{end}}
|
||||
{{ $base := ($.Page.File.LogicalName) }}
|
||||
{{ $anchorId := ($header | plainify | htmlEscape | urlize) }}
|
||||
{{ $href := delimit (slice $base $anchorId) "#" | string }}
|
||||
<a href="{{ relref $.Page $href }}">
|
||||
<li>{{ $header | plainify | htmlEscape }}</li>
|
||||
</a>
|
||||
{{ range seq $next_heading }}
|
||||
</ul>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
|
@ -22,4 +22,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -22,4 +22,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -24,4 +24,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -25,4 +25,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -36,4 +36,6 @@
|
|||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
|
@ -36,4 +36,6 @@
|
|||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/componenttoc.html" . }}
|
Loading…
Reference in New Issue