blob: 1b9ef3d283fc5666405fe32f3fb609ffc54013b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 = 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. */ -}}
|