Skip to content

Commit

Permalink
Merge pull request #278 from mrueg/add-anchor
Browse files Browse the repository at this point in the history
feat: Support anchor macro
  • Loading branch information
mrueg authored Apr 3, 2023
2 parents a29feb1 + 9bb9f45 commit 7969bcb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions pkg/mark/stdlib/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ func templates(api *confluence.API) (*template.Template, error) {
`</ac:structured-macro>{{printf "\n"}}`,
),

/* https://confluence.atlassian.com/conf59/anchor-macro-792499068.html */

`ac:anchor`: text(
`<ac:structured-macro ac:name="anchor">{{printf "\n"}}`,
`<ac:parameter ac:name="">{{ .Anchor }}</ac:parameter>{{printf "\n"}}`,
`</ac:structured-macro>{{printf "\n"}}`,
),

// TODO(seletskiy): more templates here
} {
templates, err = templates.New(name).Parse(body)
Expand Down

0 comments on commit 7969bcb

Please sign in to comment.