From 36ae927f68021f9cae06bcabcd83bfe16aeb0059 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sat, 17 May 2025 09:23:39 +0800 Subject: feat: add an icon indicating external link Former-commit-id: b9ddcc3a0284e1aac0eb57bcfec390a2cff145a1 --- assets/css/components/_markdown.scss | 9 +++++++++ layouts/_default/_markup/render-link.html | 4 ++-- static/img/external-link.svg | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 static/img/external-link.svg diff --git a/assets/css/components/_markdown.scss b/assets/css/components/_markdown.scss index 6be34818..2b8fc737 100644 --- a/assets/css/components/_markdown.scss +++ b/assets/css/components/_markdown.scss @@ -142,3 +142,12 @@ $em-text-color: #889E73; max-width: 100%; } } + +/* additional elements */ + +.link-icon img { + width: 0.8em; + height: 0.8em; + display: inline; + opacity: 0.7; +} diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index b7a23949..16c201cd 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,6 +1,6 @@ {{ $url := .Destination | safeURL }} {{ if or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") }} - {{ .Text | safeHTML }} + {{ .Text }} {{ else }} - {{ .Text | safeHTML }} + {{ .Text }} {{ end }} diff --git a/static/img/external-link.svg b/static/img/external-link.svg new file mode 100644 index 00000000..ed2483aa --- /dev/null +++ b/static/img/external-link.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file -- cgit v1.2.3