fix: prevend wrong formatting for linked images

uci-hugo-doc
Robert Kaussow 2021-02-21 14:04:40 +01:00
parent 3f79ebfbf7
commit 0d80589019
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
3 changed files with 18 additions and 3 deletions

View File

@ -1 +1,2 @@
<a href="{{ .Destination | safeURL | relURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> {{ $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") }}
<a class="gdoc-markdown__link{{ if $raw }}--raw{{ end }}" href="{{ .Destination | safeURL | relURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>

View File

@ -15,7 +15,7 @@
<div class="flex justify-center"> <div class="flex justify-center">
<figure class="gdoc-markdown__figure"> <figure class="gdoc-markdown__figure">
<a href="{{ .RelPermalink }}"> <a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
<img <img
{{ if $lazyLoad }}loading="lazy"{{ end }} {{ if $lazyLoad }}loading="lazy"{{ end }}
{{ with $customSize }} {{ with $customSize }}

View File

@ -42,7 +42,8 @@
font-weight: bolder; font-weight: bolder;
} }
a { a,
&__link {
text-decoration: none; text-decoration: none;
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
line-height: 1em; line-height: 1em;
@ -52,6 +53,19 @@
} }
} }
&__link--raw {
text-decoration: none;
color: $body-font-color;
&:hover {
text-decoration: none;
}
&:visited {
color: $body-font-color;
}
}
img { img {
max-width: 100%; max-width: 100%;
border-radius: $border-radius; border-radius: $border-radius;