Access Keys:
Skip to content (Access Key - 0)

html-tag macro

This macro is no longer supported.

Overview:

The {html-tag} macro provides a safe mechanism for the addition of specific HTML tags and attributes to be inserted in to your content...

There are times when Wiki Markup Editor doesn't quite provide enough flexibility and the need arises to add custom HTML tags to a page.

There are various ways in which you can do this:

  • Create a plugin or user macro - requires administrator privileges and often knowledge of programming
  • Use the html macro or html-include macro - these can be dangerous if mis-used

To overcome these problems, the {html-tag} macro has been created which has the following advantages:

  • Only whitelisted HTML tags and attributes can be used - this prevents mis-use of the macro
  • The whitelist can be altered to your own needs - this allows you to customise the macro
  • Errors are clearly reported on the page through the macro framework - this makes it easy to spot and resolve mistakes
  • Allows XHTML compliant output

By inhibiting possibly dangerous tags and attributes, you can provide this macro to a wider audience of users.

Several tags that are already well supported by Confluence have been excluded in a bid to promote the use of Wiki Markup Editor where available.

Parameters:

This macro is used as shown below:

{html-tag:tag=tagName|attrib1=value,...}
body content
{html-tag:tag=/tagname}
Parameter Required Notes
default The "usage" default parameter will display additional information about the macro (see examples).
tag The name of the HTML tag. Only whitelisted HTML tags are allowed.

There are three states for the tag parameter:
${renderedContent}
attributes Any additional parameters will define attributes for the HTML tag. Only whitelisted attributes are allowed. Attributes can only be added to an Open or Empty Tag.

Notes:

As this macro does not have a body, the space between them will be parsed by Confluence as it would normally. Be careful with your whitespacing!

Examples

Hints and Tips:

This macro makes it easy to apply your own stylesheets to elements within a page. First, create a Custom CSS Style in Builder's Theme Configuration 1.6.x then wrap your content in a "span" or "div" tag with the desired "class" attribute.

Frequently Asked Questions:

Q Does this macro guarantee safe use?
A No. While it's certainly far, far safer than the html macro, Adaptavist do not provide any warranties that it is fit for any purpose.
Q How did you create that nested table in the Parameters section?
A We found that if you wrap the inner table in a macro that has a body tag, it nests quite well as it gets rendered seperately!
Q I uploaded the html tag plugin to my confluence 2.1.x installation however when I try to use it, it doesnt work?
A For confluence 2.1.x the html-tag macro needs to be installed into the WEB-INF/lib folder

See Also:



Ask questions, get help and report bugs & issues on our Community Site

View old comments


Adaptavist Theme Builder Powered by Atlassian Confluence