From 7810026589bbcea474423b223433c54d786a92b4 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 25 Oct 2023 09:11:10 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20extra=20whitespace=20added?= =?UTF-8?q?=20in=20render=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #679 --- .prettierrc | 2 ++ CHANGELOG.md | 4 ++++ layouts/_default/_markup/render-heading.html | 2 +- layouts/_default/_markup/render-image.html | 2 +- layouts/_default/_markup/render-link.html | 17 +++++++++-------- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.prettierrc b/.prettierrc index d884083f..15acafac 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,11 @@ { + "plugins": ["prettier-plugin-go-template"], "goTemplateBracketSpacing": true, "htmlWhitespaceSensitivity": "css", "printWidth": 100, "singleQuote": false, "tabWidth": 2, + "useTabs": false, "trailingComma": "es5", "overrides": [ { diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e9df036..22be3bed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- Extra whitespace added after links ([#679](https://github.com/jpanther/congo/issues/679)) + ## [2.7.1] - 2023-10-24 ### Changed diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index 2cb38063..d1d4575a 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -1 +1 @@ -{{ .Text | safeHTML }} {{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}#{{ end }} +{{ .Text | safeHTML }} {{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}#{{ end }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index c1fe3634..ac82a6aa 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -61,4 +61,4 @@ {{ with $caption }}
{{ . | markdownify }}
{{ end }} {{ end }} -{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index e42c035c..d0d013ae 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,10 +1,11 @@ {{ $link := .Destination }} {{ $isRemote := strings.HasPrefix $link "http" }} -{{- if not $isRemote -}} -{{ $url := urls.Parse .Destination }} -{{- if $url.Path -}} -{{ $fragment := "" }} -{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} -{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}} -{{- end -}} -{{ .Text | safeHTML }} +{{- if not $isRemote }} + {{ $url := urls.Parse .Destination }} + {{ if $url.Path }} + {{ $fragment := "" }} + {{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} + {{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end -}} + {{ end }} +{{ end -}} +{{- .Text | safeHTML -}} \ No newline at end of file