Skip to content

Commit

Permalink
fix: fix formatting on feature and code links (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored Feb 2, 2022
1 parent 9636d81 commit 967a75b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
1 change: 1 addition & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
default: True
MD013: False
MD041: False
MD042: False
MD004:
style: dash
2 changes: 1 addition & 1 deletion exampleSite/content/posts/features/code-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To display an inline shortcode use single quotes:
`some code`
```

**Example:** `some code`
**Example:** `some code` with a [`link`](#)

## Code blocks

Expand Down
10 changes: 8 additions & 2 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
{{- $code := hasPrefix .Text "<code" -}}
<a
class="gblog-markdown__link{{ if $raw }}--raw{{ end }}"
class="gblog-markdown__link{{ if $raw -}}
--raw
{{- else if $code -}}
--code
{{- end }}"
href="{{ .Destination | safeURL }}"
{{ with .Title }}title="{{ . }}"{{ end }}
>{{ .Text | safeHTML }}</a
>
{{- .Text | safeHTML -}}
</a>
{{- /* Drop trailing newlines */ -}}
19 changes: 14 additions & 5 deletions src/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ img {
}

&__readmore {
margin: 1.5rem 0 $padding-32 0;
margin: $padding-16 0;

a:visited {
color: var(--link-color);
Expand Down Expand Up @@ -369,20 +369,29 @@ img {
}

span {
background: rgba($gray-900, 0.8);
background: $gray-800;
position: absolute;
bottom: 0;
right: 0;
padding: $padding-4;
padding: $padding-4 $padding-8;
font-size: 0.8em;
color: $gray-100;
border-radius: $border-radius 0;
}

a:hover,
a {
text-decoration: none;
color: $link-color-dark;
}

a:hover {
text-decoration: underline;
background: none;
}

a:visited,
a:visited:hover {
color: $gray-100 !important;
color: $link-color-dark;
}
}

Expand Down
18 changes: 18 additions & 0 deletions src/sass/_markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@
}
}

&__link--code {
text-decoration: none;
code {
color: inherit !important;
}

&:hover {
background: none;
color: var(--link-color) !important;
text-decoration: underline;
}

&:visited,
&:visited:hover {
color: var(--link-color-visited) !important;
}
}

img {
max-width: 100%;
border-radius: $border-radius;
Expand Down

0 comments on commit 967a75b

Please sign in to comment.