From 3d96781f477d02c341d70d9c434b8480d688027d Mon Sep 17 00:00:00 2001 From: Yurii Myronov Date: Tue, 5 Nov 2024 10:24:41 +0200 Subject: [PATCH] Support named excerpts - Resolves feature request #316 --- README.md | 2 ++ stdlib/stdlib.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index e79701e..dddacf4 100644 --- a/README.md +++ b/README.md @@ -432,10 +432,12 @@ By default, mark provides several built-in templates and macros: * template: `ac:excerpt-include` to include the excerpt from another page * Page: the page the excerpt should be included from + * Name: The specific identifier for the excerpt, allowing multiple Excerpt macros on one page to be referenced individually. If not provided, the first excerpt from the page will be used (optional, cloud only) * NoPanel: Determines whether Confluence will display a panel around the excerpted content (optional, default: false) * template: `ac:excerpt` to create an excerpt and include it in the page * Excerpt: The text you want to include + * Name: Allows you to identify this macro so that you can add multiple Excerpt macros to one page and use a specific one on another page using the Excerpt Include macro (optional, cloud only) * 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) diff --git a/stdlib/stdlib.go b/stdlib/stdlib.go index 6986f1c..e4e7d36 100644 --- a/stdlib/stdlib.go +++ b/stdlib/stdlib.go @@ -296,18 +296,22 @@ func templates(api *confluence.API) (*template.Template, error) { ), /* https://confluence.atlassian.com/conf59/excerpt-include-macro-792499101.html */ + /* https://support.atlassian.com/confluence-cloud/docs/insert-the-excerpt-include-macro/ */ `ac:excerpt-include`: text( ``, + `{{ if .Name }}{{ .Name }}{{ end }}`, `{{ if .NoPanel }}{{ .NoPanel }}{{ else }}false{{ end }}`, `{{ .Page }}`, ``, ), /* https://confluence.atlassian.com/conf59/excerpt-macro-792499102.html */ + /* https://support.atlassian.com/confluence-cloud/docs/insert-the-excerpt-macro/ */ `ac:excerpt`: text( ``, + `{{ if .Name }}{{ .Name }}{{ end }}`, `{{ if .Hidden }}{{ .Hidden }}{{ else }}false{{ end }}`, `{{ if .OutputType }}{{ .OutputType }}{{ else }}BLOCK{{ end }}`, ``,