From 5730919857b1f6a31784c95a305bf924436678c2 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 7 Oct 2023 20:19:06 -0400 Subject: themes/default/layouts/shortcodes/mark: Support id --- themes/default/layouts/shortcodes/mark.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'themes/default/layouts/shortcodes') 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 -}} -{{- $text -}} +{{- if $id -}} + {{- $id = print "mark:" (truncate 30 "" $text | anchorize | replaceRE `\d` "") -}} + {{- $id = printf `id=%q` $id -}} +{{- end -}} + +{{- $text | markdownify -}} {{- /* This comment removes trailing newlines and white spaces. */ -}} -- cgit v1.2.3