RenderHooks: Reconfigure the heading hashes
Instead of a single hash in the left gutter, draw <n> hashes where <n> is the heading level. All of these hashes are part of the anchor text.
This commit is contained in:
parent
c30805127c
commit
cce432fe0b
2 changed files with 33 additions and 6 deletions
|
@ -1,8 +1,11 @@
|
|||
<h{{ .Level }} id="{{ .Anchor }}" class="heading">
|
||||
{{ .Text | safeHTML }}
|
||||
{{- $pageWantsAnchors := .Page.Params.renderHeadingAnchors | default true -}}
|
||||
{{- $anchorEnabledForThisHeading := .Attributes.anchor | default true -}}
|
||||
{{- if and $pageWantsAnchors $anchorEnabledForThisHeading -}}
|
||||
<a class="heading__anchor" href="#{{ .Anchor }}">#</a>
|
||||
{{- $pageWantsAnchors := .Page.Params.renderHeadingAnchors | default true -}}
|
||||
{{- $anchorEnabledForThisHeading := .Attributes.anchor | default true -}}
|
||||
{{- $hasAnchor := and $pageWantsAnchors $anchorEnabledForThisHeading -}}
|
||||
<h{{ .Level }} id="{{ .Anchor }}" class="heading{{ if $hasAnchor }} with-anchor{{ end }}">
|
||||
{{- if $hasAnchor -}}
|
||||
<span class="heading__anchor">
|
||||
<a href="#{{ .Anchor }}">{{ range seq .Level }}#{{ end }}</a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{ .Text | safeHTML }}
|
||||
</h{{ .Level }}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue