From 08f37fe2b91d602c815a79f26bd5a146daf58e34 Mon Sep 17 00:00:00 2001 From: guoweis-outreach <639243+guoweis-outreach@users.noreply.github.com> Date: Wed, 8 Dec 2021 21:14:01 -0800 Subject: [PATCH] feat: add iframe support (#143) * feat: add iframe support * add comment --- README.md | 17 +++++++++++++++++ pkg/mark/stdlib/stdlib.go | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/README.md b/README.md index fd6956c..9848183 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,23 @@ By default, mark provides several built-in templates and macros: See: https://confluence.atlassian.com/doc/children-display-macro-139501.html +* template: `ac:iframe` to include iframe macro (cloud only) + - URL: URL to the iframe. + - Frameborder: Choose whether to draw a border around content in the iframe. + - `show` (Default) + - `hide` + - Width: Width in px. Defualts to "640px" + - Height: Height in px. Defualts to "360px" + - Scrolling: Allow or prevent scrolling in the iframe to see additional content. + - `yes` + - `no` + - `auto` (Default) + - Align: Align the iframe to the left or right of the page. + - `left` (Default) + - `right` + + See: https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro + * 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 de092f2..01f6f4e 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -210,6 +210,19 @@ func templates(api *confluence.API) (*template.Template, error) { `{{printf "\n"}}`, ), + /* https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro/ */ + + `ac:iframe`: text( + `{{printf "\n"}}`, + `{{printf "\n"}}`, + `{{ if .Frameborder}}{{ .Frameborder }}{{printf "\n"}}{{end}}`, + `{{ if .Scrolling}}{{ .Scrolling }}{{printf "\n"}}{{end}}`, + `{{ if .Align}}{{ .Align }}{{printf "\n"}}{{end}}`, + `{{ or .Width "640px" }}{{printf "\n"}}`, + `{{ or .Height "360px" }}{{printf "\n"}}`, + `{{printf "\n"}}`, + ), + // TODO(seletskiy): more templates here } { templates, err = templates.New(name).Parse(body)