From 08281712cc609fa4867d0383455276e1a786f1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Mon, 22 May 2023 17:22:32 +0200 Subject: [PATCH] Add expand macro --- README.md | 4 ++++ pkg/mark/stdlib/stdlib.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 206fc0e..fe41f30 100644 --- a/README.md +++ b/README.md @@ -417,6 +417,10 @@ By default, mark provides several built-in templates and macros: * template: `ac:anchor` to set an anchor inside a page - Anchor: Text for the anchor ++ template: `ac:expand` to display an expandable/collapsible section of text on your page + - Title: Defines the text next to the expand/collapse icon. + - Body: The Text that it is expanded to. + * macro `@{...}` to mention user by name specified in the braces. ## Template & Macros Usecases diff --git a/pkg/mark/stdlib/stdlib.go b/pkg/mark/stdlib/stdlib.go index 427f251..3a1cb2a 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -310,6 +310,15 @@ func templates(api *confluence.API) (*template.Template, error) { `{{printf "\n"}}`, ), + /* https://confluence.atlassian.com/conf59/expand-macro-792499106.html */ + + `ac:expand`: text( + `{{printf "\n"}}`, + `{{ .Title }}{{printf "\n"}}`, + `{{ .Body }}{{printf "\n"}}`, + ``, + ), + // TODO(seletskiy): more templates here } { templates, err = templates.New(name).Parse(body)