aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/mark.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/shortcodes/mark.html')
-rw-r--r--themes/default/layouts/shortcodes/mark.html10
1 files changed, 8 insertions, 2 deletions
diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html
index 122a521..1b9ef3d 100644
--- a/themes/default/layouts/shortcodes/mark.html
+++ b/themes/default/layouts/shortcodes/mark.html
@@ -1,9 +1,15 @@
{{- $text := default "mark" (.Get "text" | default (.Get 0)) -}}
{{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}}
+{{- $id := default "" (.Get "id" | default (.Get 2)) -}}
{{- if gt (len .Inner) 1 -}}
- {{- $text = .Inner -}}
+ {{- $text = trim .Inner "\n" -}}
{{- end -}}
-<mark title="{{- $title -}}">{{- $text -}}</mark>
+{{- 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. */ -}}