Add markup renderers
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
10
assets/sass/heading.scss
Normal file
10
assets/sass/heading.scss
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.heading {
|
||||||
|
.heading-anchor {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading:hover .heading-anchor {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
@@ -6,6 +6,7 @@ $width-max: 60rem;
|
|||||||
@import "fonts";
|
@import "fonts";
|
||||||
@import "common";
|
@import "common";
|
||||||
|
|
||||||
|
@import "heading";
|
||||||
@import "image";
|
@import "image";
|
||||||
|
|
||||||
@import "header";
|
@import "header";
|
||||||
|
4
layouts/_default/_markup/render-heading.html
Normal file
4
layouts/_default/_markup/render-heading.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<h{{ .Level }} id="{{- .Anchor | safeURL -}}" class="heading">
|
||||||
|
{{ .Text | safeHTML }}
|
||||||
|
<a href="#{{- .Anchor | safeURL -}}" class="heading-anchor">#</a>
|
||||||
|
</h{{ .Level }}>
|
6
layouts/_default/_markup/render-image.html
Normal file
6
layouts/_default/_markup/render-image.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{{ partial "image.html" (dict
|
||||||
|
"path" .Destination
|
||||||
|
"caption" .Text
|
||||||
|
"alt" .Title
|
||||||
|
)
|
||||||
|
}}
|
9
layouts/_default/_markup/render-link.html
Normal file
9
layouts/_default/_markup/render-link.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<a
|
||||||
|
href="{{- .Destination | safeURL -}}"
|
||||||
|
{{ with .Title }}title="{{- . -}}"{{ end }}
|
||||||
|
{{ if strings.HasPrefix .Destination "http" }}
|
||||||
|
target="_blank" rel="noopener"
|
||||||
|
{{ end }}
|
||||||
|
>
|
||||||
|
{{ .Text | safeHTML }}
|
||||||
|
</a>
|
@@ -1,10 +1,14 @@
|
|||||||
{{- $path := .path -}}
|
{{- $path := .path -}}
|
||||||
{{- $alt := .alt -}}
|
|
||||||
{{- $caption := .caption -}}
|
{{- $caption := .caption -}}
|
||||||
|
{{- $alt := default .caption .alt -}}
|
||||||
|
|
||||||
{{ if $path }}
|
{{ if $path }}
|
||||||
<figure class="image">
|
<figure class="image">
|
||||||
<img src="{{- $path | absURL -}}" {{ with $alt }}alt="{{- . -}}"{{ end }} />
|
<img
|
||||||
|
src="{{- $path | absURL -}}"
|
||||||
|
{{ with $caption }}title="{{- . -}}"{{ end }}
|
||||||
|
{{ with $alt }}alt="{{- . -}}"{{ end }}
|
||||||
|
/>
|
||||||
{{ with $caption }}
|
{{ with $caption }}
|
||||||
<figcaption>{{ . }}</figcaption>
|
<figcaption>{{ . }}</figcaption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -32,5 +32,7 @@
|
|||||||
".envrc"
|
".envrc"
|
||||||
"public/**"
|
"public/**"
|
||||||
"static/**"
|
"static/**"
|
||||||
|
# FIXME: https://github.com/NiklasPor/prettier-plugin-go-template/issues/120
|
||||||
|
"layouts/_default/_markup/render-heading.html"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user