Skip to content

Commit

Permalink
Simplify code in render-heading.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeso committed Apr 24, 2024
1 parent 1d36d8e commit e6d3b5d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<h{{ add .Level site.Params.headingoffset }} id="{{ safeURL .Anchor }}">
<a class="Heading-link u-clickable" href="{{ .Page.RelPermalink }}#{{ safeURL .Anchor }}">{{ safeHTML .Text }}</a>
</h{{ add .Level site.Params.headingoffset }}>
{{ $level := add .Level site.Params.headingoffset | math.Max 1 }}
{{ $anchor := safeURL .Anchor }}

<h{{ $level }} id="{{ $anchor }}">
<a class="Heading-link u-clickable" href="{{ .Page.RelPermalink }}#{{ $anchor }}">{{ safeHTML .Text }}</a>
</h{{ $level }}>

0 comments on commit e6d3b5d

Please sign in to comment.