diff options
Diffstat (limited to 'themes/default/layouts/shortcodes/mark.html')
-rw-r--r-- | themes/default/layouts/shortcodes/mark.html | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html index 02af225..1b9ef3d 100644 --- a/themes/default/layouts/shortcodes/mark.html +++ b/themes/default/layouts/shortcodes/mark.html @@ -1,5 +1,15 @@ -{{- $text := default "highligted text" (.Get "text" | default (.Get 0)) -}} -{{- $title := default $text (.Get "title" | default (.Get 1)) -}} +{{- $text := default "mark" (.Get "text" | default (.Get 0)) -}} +{{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}} +{{- $id := default "" (.Get "id" | default (.Get 2)) -}} -<mark title="{{ $title }}">{{ $text }}</mark> +{{- if gt (len .Inner) 1 -}} + {{- $text = trim .Inner "\n" -}} +{{- end -}} + +{{- if $id -}} + {{- $id = print "mark:" (truncate 30 "" $text | anchorize | replaceRE `\d` "") -}} + {{- $id = printf `id=%q` $id -}} +{{- end -}} + +<mark {{ $id | safeHTMLAttr }} title="{{- $title -}}"><span>{{- $text | markdownify -}}</span></mark> {{- /* This comment removes trailing newlines and white spaces. */ -}} |