Wiki source code of Macro(s)

Last modified by Normann P. Nielsen on 2013/01/17 21:57

Show last authors
1 Styling at the Macro level is a bit special, in general Macro's are applied on a page via the RTE, but they can also be used in the [[Global Layout>>Main.atlassian.atlassian-confluence.styling-confluence.global-layout]], Page Layout, [[Layouts for a space>>Main.atlassian.atlassian-confluence.styling-confluence.layouts-for-a-space]] and so on, the reason is that changing it is quite easy via Confluence  Administration -> General Configuration -> User Macros - So we dont have to mess around in the layouts, which can be a bit risky.
2
3 A macro can be from a very simple style containing only something like:
4
5
6 {{code}}
7 ## @noparams
8 <style><!--
9 div\#renderChildren { visibility:hidden;display:none; }
10 --></style>
11 {{/code}}
12
13 to a large macro containing someting like a complete footer, se my footer [[here>>Main.atlassian.atlassian-confluence.styling-confluence.footer-macro-sample]] and header [[here>>Main.atlassian.atlassian-confluence.styling-confluence.header-macro-sample]]
14
15 Macro's are exeptional handy and easy to use and apply per page, and can typically be used (in CSS Context to hide/show - and change objects).
16
17 = Creating Macros =
18
19 See [[User Macros>>Main.atlassian.atlassian-confluence.user-macros]] for at lot of macro's and [[https://confluence.atlassian.com/display/DISC/Shared+User+Macros]] for older macro's
20
21 Parameter guide: [[https://confluence.atlassian.com/display/DOC/Guide+to+User+Macro+Templates]]
22
23 = In the Rich Text Editor (RTE) =
24
25 In the RTE, macro's can be inserted via the GUI:
26
27 [[image:InsertMacroInRTE.jpg||width="300"||alt="InsertMacroInRTE.jpg"]]
28
29
30
31 = In the Layout(s) for Global, Page, Blog post etc.. =
32
33 In the Layouts, the Macro's are rendered via the $helper:
34
35
36 {{code}}
37 $helper.renderConfluenceMacro("{my-macro-style}")
38 {{/code}}
39
40 or
41
42
43 {{code}}
44 $helper.renderConfluenceMacro("{related-content:showSpace=false|showLabels=false|max=10}")
45 {{/code}}
46
47
48
49
50
51 = My User Macros: =