From 9bb9f45326f0ce56c6783fc8c6a3ce60d3db5579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Mon, 3 Apr 2023 13:05:35 +0200 Subject: [PATCH] feat: Support anchor macro --- README.md | 3 +++ pkg/mark/stdlib/stdlib.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index d643044..91a46ea 100644 --- a/README.md +++ b/README.md @@ -384,6 +384,9 @@ By default, mark provides several built-in templates and macros: - OutputType: Determines whether the content of the Excerpt macro body is displayed on a new line or inline (optional, options: "BLOCK" or "INLINE", default: BLOCK) - Hidden: Hide the excerpt content (optional, default: false) +* template: `ac:anchor` to set an anchor inside a page + - Anchor: Text for the anchor + * 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 d8b1998..6df86d8 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -294,6 +294,14 @@ func templates(api *confluence.API) (*template.Template, error) { `{{printf "\n"}}`, ), + /* https://confluence.atlassian.com/conf59/anchor-macro-792499068.html */ + + `ac:anchor`: text( + `{{printf "\n"}}`, + `{{ .Anchor }}{{printf "\n"}}`, + `{{printf "\n"}}`, + ), + // TODO(seletskiy): more templates here } { templates, err = templates.New(name).Parse(body)