From e884f4927f3e48285ca6689507f5e0f61072de04 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 29 Jun 2022 17:17:53 -0700 Subject: [PATCH] fix: anchor formatting (closes #141) --- content/notes/config.md | 4 +--- content/notes/editing.md | 2 +- layouts/partials/textprocessing.html | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/content/notes/config.md b/content/notes/config.md index 320a16d97..2c1e352f8 100644 --- a/content/notes/config.md +++ b/content/notes/config.md @@ -179,6 +179,4 @@ defaultContentLanguage = 'ar' languagedirection = 'rtl' title = 'مدونتي' weight = 1 -``` - -[[setup]] \ No newline at end of file +``` \ No newline at end of file diff --git a/content/notes/editing.md b/content/notes/editing.md index 53f537c80..4aaf58563 100644 --- a/content/notes/editing.md +++ b/content/notes/editing.md @@ -34,7 +34,7 @@ You can also use wikilinks if that is what you are more comfortable with! ### 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. -```markdown +```yaml --- title: "Example Title" tags: diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html index 8e8c99917..56e2e8bab 100644 --- a/layouts/partials/textprocessing.html +++ b/layouts/partials/textprocessing.html @@ -39,7 +39,7 @@ {{$reference := split $path "#"}} {{$title := index $reference 0}} {{$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}} {{$display := default $title (index $split 1)}} {{if not $href}} @@ -54,7 +54,7 @@ {{end}} {{end}} -{{/* Add copyable anchors */}} +{{/* Add jumpable anchors */}} {{ $content = $content | replaceRE "()(.+)()" `${1}# ${3}${4}` }} {{ $content | safeHTML }}