mirror of
https://github.com/falsycat/ar.falsy.cat.git
synced 2024-12-26 08:24:51 +00:00
fix: anchor formatting (closes #141)
This commit is contained in:
parent
2b0482ae4c
commit
e884f4927f
@ -180,5 +180,3 @@ defaultContentLanguage = 'ar'
|
|||||||
title = 'مدونتي'
|
title = 'مدونتي'
|
||||||
weight = 1
|
weight = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
[[setup]]
|
|
@ -34,7 +34,7 @@ You can also use wikilinks if that is what you are more comfortable with!
|
|||||||
### Front Matter
|
### Front Matter
|
||||||
Hugo is picky when it comes to metadata for files. Make sure that your title is double-quoted and that you have a title defined at the top of your file like so. You can also add tags here as well.
|
Hugo is picky when it comes to metadata for files. Make sure that your title is double-quoted and that you have a title defined at the top of your file like so. You can also add tags here as well.
|
||||||
|
|
||||||
```markdown
|
```yaml
|
||||||
---
|
---
|
||||||
title: "Example Title"
|
title: "Example Title"
|
||||||
tags:
|
tags:
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
{{$reference := split $path "#"}}
|
{{$reference := split $path "#"}}
|
||||||
{{$title := index $reference 0}}
|
{{$title := index $reference 0}}
|
||||||
{{$block := default "" (index $reference 1)}}
|
{{$block := default "" (index $reference 1)}}
|
||||||
{{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block))}}
|
{{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
|
||||||
{{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
|
{{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
|
||||||
{{$display := default $title (index $split 1)}}
|
{{$display := default $title (index $split 1)}}
|
||||||
{{if not $href}}
|
{{if not $href}}
|
||||||
@ -54,7 +54,7 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{/* Add copyable anchors */}}
|
{{/* Add jumpable anchors */}}
|
||||||
{{ $content = $content | replaceRE "(<h[1-9] id=\"([^\"]+)\">)(.+)(</h[1-9]>)" `<a href="#${2}">${1}<span class="hanchor" ariaLabel="Anchor"># </span>${3}${4}</a>` }}
|
{{ $content = $content | replaceRE "(<h[1-9] id=\"([^\"]+)\">)(.+)(</h[1-9]>)" `<a href="#${2}">${1}<span class="hanchor" ariaLabel="Anchor"># </span>${3}${4}</a>` }}
|
||||||
|
|
||||||
{{ $content | safeHTML }}
|
{{ $content | safeHTML }}
|
||||||
|
Loading…
Reference in New Issue
Block a user