feat: add iframe support (#143)

* feat: add iframe support

* add comment
This commit is contained in:
guoweis-outreach 2021-12-08 21:14:01 -08:00 committed by GitHub
parent ac8133a8b9
commit 08f37fe2b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -210,6 +210,19 @@ func templates(api *confluence.API) (*template.Template, error) {
`</ac:structured-macro>{{printf "\n"}}`,
),
/* https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro/ */
`ac:iframe`: text(
`<ac:structured-macro ac:name="iframe">{{printf "\n"}}`,
`<ac:parameter ac:name="src"><ri:url ri:value="{{ .URL }}" /></ac:parameter>{{printf "\n"}}`,
`{{ if .Frameborder}}<ac:parameter ac:name="frameborder">{{ .Frameborder }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Scrolling}}<ac:parameter ac:name="id">{{ .Scrolling }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Align}}<ac:parameter ac:name="align">{{ .Align }}</ac:parameter>{{printf "\n"}}{{end}}`,
`<ac:parameter ac:name="width">{{ or .Width "640px" }}</ac:parameter>{{printf "\n"}}`,
`<ac:parameter ac:name="height">{{ or .Height "360px" }}</ac:parameter>{{printf "\n"}}`,
`</ac:structured-macro>{{printf "\n"}}`,
),
// TODO(seletskiy): more templates here
} {
templates, err = templates.New(name).Parse(body)