This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

HTML Plugin

Name Html Plugin
Vendor Bob Swift and other contributors
Authors Bob Swift
Homepage http://confluence.atlassian.com/display/CONFEXT/Html+Plugin
Issue Management http://developer.atlassian.com/jira/browse/html
Continuous Integration n/a
Categories Content Macros
Most Recent Version 3.1.0
Availability Confluence v2.4.2 to v2.10
State Stable
Support Unsupported Plugins
License Freeware / Open Source (BSD)
Price Free
Release Docs http://confluence.atlassian.com/display/CONFEXT/Html+Plugin
Java API Docs n/a
Download Source http://svn.atlassian.com/svn/public/contrib/confluence/html-plugin/trunk
Download JAR html-plugin-3.1.0.jar

Additions and corrections to above

JVM requirements Java 1.4 and above
Installation requirements Confluence Repository Client
or upload from Confluence's administration console.
Cannot be installed in /WEB-INF/lib

Description

Collection of macros for rendering HTML and related markup inside a Confluence page.

  • HTML macro - Renders HTML markup code and scripts inside a Confluence page (described below)
  • XSLT Macro

HTML Macro

Features

  • Supports security restrictions as described in Macro Security Plugin.
  • Supports capabilities for including data similar to other scripting macros.
    Security

    If you have untrusted users on your site, then you should setup Macro Security Plugin before enabling the html macro.

Other HTML macros

  • {html} and {html-include} macros shipped with Confluence. See the Confluence User Guide: HTML Macro and HTML Include Macro. These macros are disabled by default in Confluence, since it is a security exposure unless you only have trusted users on your site. The Confluence HTML macro must be disabled for the new html macro to be used.
  • HTML Tag - a safer alternative to the standard {html} macro but does not allow for arbitrary html to be included.

Documentation

  • Help available in the notation guide.

Parameters

  • output - Determines how the output is formated:
    • html - Data is output as HTML (default).
    • wiki - Data is surrounded by a {noformat} macro.
  • script - Location of HTML data. Default is the macro body only. If a location of data is specified, the included data will follow the body data.
    • #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
    • #http://... - Data is read from the URL specified.
    • ^attachment - Data is read from an attachment to the current page.
    • page^attachment - Data is read from an attachment to the page name provided.
    • space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.
  • noPanel - When output=wiki, show the data within a panel (default) unless nopanel=true
    Direct file access

    The script macros access the script directory in Confluence home for file access.

Usage

Example - HTML from a file in the script folder in the Confluence home directory

{html:script=#example.html}
{html}

Example - HTML from an attachement

{html:script=^example.html}
{html}

Example - HTML put within {noformat} panel

{html:output=wiki|noPanel=true}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam fermentum vestibulum est. Cras rhoncus.
{html}

Example - HTML from an URL

{html:script=#http://localhost/example.html}
{html}

Example - use of CSS inline style sheet

{html}
<P style="font-size: x-large; color: #8000">
   Using inline style sheets - or is that inline styles?
</p>
{html}

Example - use of CSS external style sheet

{html}
<LINK href="http://www.cssgarden.com/css/T22/keylime_0001.css"  rel="stylesheet" title="default" type="text/css"></LINK>
<H1>Absolute </H1>
{html}

Note: Make sure that style sheet is available on a server and provide absolute URL reference to this external style sheet resource.

Version History

Version Date Author Notes
3.1.0 22-Jun-2007 Bob Swift release notes

Release Notes

  • 3.1.0
    When: 22-Jun-2007
    Who: Bob Swift
    What:

Open Issues

Labels

plugin plugin Delete
macro_security macro_security Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 18, 2006

    Guy Fraser says:

    Bob, Would it be worth having a different name for this macro to distinguish it...

    Bob,

    Would it be worth having a different name for this macro to distinguish it from Atlassian's {html} macro?

    Guy

    1. Jan 18, 2006

      Dan Hardiker says:

      As it is a drop-in replacement for the Atlassian's {html} macro (you would only ...

      As it is a drop-in replacement for the Atlassian's {html} macro (you would only have one or the other active at any one time - they do the same thing, this is just an enhanced version), I would suggest leaving it as the same.

      My general rule of thumb is, if you want them to run side by side - name them different. If it's an extension aimed at replacing an existing macro - name it the same.

      There is always the possibility of macro name collisions (should both be enabled at once), but with the {html} macro defaulting to disabled, I think this risk is minimalized. (off topic: Confluence should deal with plugin clashes better, asking which should survive the collision)

    2. Jan 18, 2006

      Bob Swift says:

      It is easy to provide an additional html2 synonym if necessary, but it should be...

      It is easy to provide an additional html2 synonym if necessary, but it should be a complete replace as in Dan's comment. The only difference is the removal of the html and body tags.

  2. Jan 27, 2006

    Gee Jee says:

    For clarity sake it might be a good idea to mention that the script directory is...

    For clarity sake it might be a good idea to mention that the script directory is in the data home for confluence, which is not always the same as the confluence home dir.

    Second, I was wondering if there would be  a way to make confluence index the conent referred to by this html plugin. It would already be nice if this would only work for local content alone. Any thoughts?

    1. Jan 27, 2006

      Bob Swift says:

      Gerard, thanks for the comments: Not sure what other home you mean but it is t...

      Gerard, thanks for the comments:

      1. Not sure what other home you mean but it is the directory identified by the confluence.home property defined in the confluence-init.properties file. I will try to clarify that when I improve the documentation.
      2. Indexing content. I think this is a important idea although I do not know how to approach it. Could you create a issue in the issue tracker please?
      3. Local content. So you would like to limit the macro to NOT allow url access? Yes, this is possible if I add some additional security restrictions. Please create an issue and its likely it can be included next release.
      1. Feb 02, 2006

        Gee Jee says:

        Bob, 1. I see what you mean. I thought that confluence home migth refer to the ...

        Bob,

        1. I see what you mean. I thought that confluence home migth refer to the directory where confluence itself was installed.  You refer to the directory where all the data is located, the one Confluence internally refers to as confluence.home. To further clarify: My confluence is installed in /appl/confluence and the date (aka confluence.home) is in /data/server/confluence. I think by default confluence.home is a subdir of the directory where you install confluence, but I choose a different structure to make backups and upgrades easier. 

        2. Did that, registered as issue SCRP-50.

        3. I think you misunderstood me here. I was just refering to the search issue. The assumption made was that it would probably be easier to implement a search / indexing on only locally placed html content, compared with html included from a remote site.  So as far as I am concerned this is not a security thing.

         

        1. Feb 02, 2006

          Bob Swift says:

          Gerard, thanks for creating the issue. I understand now what you meant.

          Gerard, thanks for creating the issue. I understand now what you meant.

  3. Aug 24, 2006

    mike poyser says:

    Something is set-up correctly on my server Unknown macro: {html-include} Unkno...

    Something is set-up correctly on my server

    Unknown macro: {html-include}
    Unknown macro: {html-include}
    Unknown macro: {html-include}
    Unknown macro: {html}

    Could not download: http://files.adaptavist.com/repository//repository-b525.xml Could not download: http://www.atlassian.com Could not download: http://amsl-server:8090/confluence/display/PUB/Home

    from logs

    2006-08-24 08:35:11,107 ERROR [radeox.macros.include.AbstractHttpRetrievalMacro] retrieveRemoteUrl Failed to download file.java.net.UnknownHostException: www.atlassian.com

  4. Aug 25, 2006

    mike poyser says:

    After more investigating into this  i think its more to do with the tomcat ...

    After more investigating into this  i think its more to do with the tomcat webserver running behind a firewall and not allowing external links.  I need to establish how to define proxy gateway /user/password.

  5. Feb 22, 2007

    Nicholas Mannella says:

    How do I create images with the Unknown macro: {html} macro?  I want to in...

    How do I create images with the

    Unknown macro: {html}
    macro?  I want to include images I have attached to my page already, not external images.  I tried this:

    <img src="^image.jpg" width="75" height="75">

    and

    <img src="!image.jpg" width="75" height="75">

     But I keep getting a broken image link when the page renders.  Can anyone point me to some documentation?  Thanks.

    1. Jun 17, 2007

      Bob Swift says:

      Not sure what you are trying to do, but you do not need the html macro to show a...

      Not sure what you are trying to do, but you do not need the html macro to show an image on a Confluence page. Displaying an Image shows you how. This includes how to add width and height parameters.

  6. Apr 10, 2007

    Max Karasik says:

    Bob, great macro! works like a charm. One caveat though: I think I know what...

    Bob, great macro! works like a charm. One caveat though: I think I know what Nicholas was referring to. I am having the same problem.

    If html page already contains <img> tags that refer to certain pictures the macro will not display those images even after attaching image files to newly created page. I have a guess what the problem might be: In order to attach a file to Confluence page - a page has to exist already. But when you create a page, using your macro those <img> tags are inactive (since no attachments yet), but after you create a page and attach those files, images don't show up either, cause a page has been already rendered via macro.

    I tried to create an empty page first, then attached images, then add macro code - not working.

    Am I missing something?

    I appreciate it.

    Thanks,

    Max.

  7. Apr 10, 2007

    Max Karasik says:

    Actually, I have a better idea why it does not work. Judging from Bob's reply, I...

    Actually, I have a better idea why it does not work. Judging from Bob's reply, I recon HTML plug-in does not render imge tags at all. Is that correct, Bob? (I played with different variances of html <img> tag layouts - macro does not render an image) That would mean one has to strip his html pages of all <img> tags first, then include those (to the best of placement) into page text, using Confluence markup, since macro renders the whole page.

    If that's true, it's really an incomplete macro. I hope I am wrong.  

    1. Apr 10, 2007

      Bob Swift says:

      Not sure what you mean. I use img tags in html macro just fine. The html macro...

      Not sure what you mean. I use img tags in html macro just fine. The html macro doesn't do any processing of the html, basically, it just passes it through. The reason for the response above is rarely do users need to use html macro and especially not for the simple task of including an attached image. Confluence has built-in support for that.
      If something you are doing in this area is not working, check to make sure you correctly referencing the image.

      {html} <a href="http://www.spreadfirefox.com/?q=affiliates&id=0&t=81"><img border="0"
        alt="Get Firefox!" title="Get Firefox!" 
        src="http://sfx-images.mozilla.org/affiliates/Buttons/80x15/blue_1.gif"/></a>
      {html}
      
  8. May 04, 2007

    Haider says:

    I put follwoing html. Unknown macro: {html} <LINK href="http://www.cssgarden...

    I put follwoing html.

    Unknown macro: {html}

    <LINK href="http://www.cssgarden.com/css/T22/keylime_0001.css" rel="stylesheet" title="default" type="text/css"></LINK>
    <H1>Absolute </H1>

    However, when I go to richtext view, it turns into the following. Any ideas why?

    Unknown macro: {html}

    Absolute

  9. May 16, 2007

    Peter Tester says:

    What was the idea behind surrounding the output=wiki by "noformat"? The xslt-mac...

    What was the idea behind surrounding the output=wiki by "noformat"? The xslt-macro renders output=wiki as wiki text and that's what I expected here also.

  10. Jun 06, 2007

    cftdanny says:

    If try to use space attachment as style sheet xslt and page source attachment as...

    If try to use space attachment as style sheet xslt and page source attachment as xml. forexample:

    {xslt:output=wiki|style=TEST:PAGE^STYLE.XSL|source=^SOURCE.XML}
    {xslt} 
    

    The xslt will produce the following error:

    xslt: Unexpected program error: java.lang.NullPointerException
    

    Anyone can help?

  11. Jun 11, 2007

    Clark Shah-Nelson says:

    We are dealing with the following issue : http://developer.atlassian.com/jira/b...

    We are dealing with the following issue :

    http://developer.atlassian.com/jira/browse/HTML-1

    When we paste in html between 2

    Unknown macro: {html}
    tags, when someone else edits the page using the rich text editor, it supercedes the wiki markup and strips the html... 

    Would using this macro solve that problem?

    1. Aug 14, 2007

      François Nonnenmacher says:

      I don't think so, since this macro exhibits the same problem. Edit a page with t...

      I don't think so, since this macro exhibits the same problem. Edit a page with the Rich Text editor and, boom, all the HTML disappears! Might be an issue with the WYSIWYG editor though. (Seen on Confluence 2.5.5 with HTML Plugin 3.1.0.)

  12. Jun 28, 2007

    R. Abeyta says:

    with regard to the comments posted by Max on April 10, 2007, I would like t...

    with regard to the comments posted by Max on April 10, 2007, I would like to add another vote for extending the macro to somehow support including images attached to the page already.  what I want to do is import a pre-existing user's manual into a separate Confluence space so that I can create another space that provides link into.  since the HTML code I'm trying to import is a user's manual, it references hundreds of images that are located in a single subdirectory of the directory where the .html file is located, e.g. <img src="images/UM/images/screenCallout.png />.  when I import the HTML file into a page using the #filename syntax and putting the file in the script folder in the Confluence home directory, everything looks great except that none of the images are there.  if I do a View Source on the Confluence page, the corresponding line looks just as it did in the original: <img src="images/UM/images/screenCallout.png />, i.e. it passes it through just as Bob said. 

    I would think that most users who want to import externally supplied HTML content would want the images referenced therein to appear.  just for kicks, I tried re-running the html macro with my images subdirectory copied to the scripts folder, but the images still don't appear.  is there a workaround for this shortcoming?

    thanks,

    becky 

    1. Jun 28, 2007

      Bob Swift says:

      I assume when you export the html you are getting a file and a directory somethi...

      I assume when you export the html you are getting a file and a directory something like:

      xxx.htm
      xxx_files
      

      Here is what you can do to cover this case:

      1. Create a directory called html (or some name of your choosing) in the same directory that has your WEB-INF directory - probably something like .../confluence-2.5.3-std/confluence
      2. Copy the xxx_files directory into that html directory
        • This makes the images and other references available to be served
      3. Modify the xxx.htm file and replace all references to xxx_files/ with /html/xxx_files/
        • This fixes up the references to images and other things to point to a location that can be served
      1. Jun 29, 2007

        R. Abeyta says:

        I tried your suggestion and the images still don't show up.  I did exactly ...

        I tried your suggestion and the images still don't show up.  I did exactly what you said:

        1. created a directory called html under my confluence installation directory:   .../confluence-2.5.3-std/confluence/html 
        2. copied the directory containing my images to the html directory, so they are located in .../confluence-2.5.3-std/confluence/html/images (about 750 .png files)
        3. modified my .html file to replace all references to "/images/UM/images" to "html/images" and renamed the file
        4. shutdown the tomcat server via the shutdown script
        5. started up the tomcat server via the startup script
        6. edited the page in my space where I am doing the import so it refers to the modified .html file:
          html:script=#RS-RMT-7.2.1-UM.html

        ater saving the page, the images still do not appear in the imported content.  I did a View Source, and the image references all refer to the new directory, e.g. \<img src="html/images/screenCallout.png" align="middle" alt="Three Main Parts"\>  the Confluence icons all show up on the page, e.g the stick figure to the left of "Home" and the little world with magnifier next to "Browse Space", etc., so it seems as though this approach ought to work.

        what am I missing?

        becky

        1. Jun 29, 2007

          Bob Swift says:

          You need a / in front of the html. <img src="/html/...

          You need a / in front of the html.

          <img src="/html/...
          
  13. Aug 03, 2007

    Matti Kiviharju says:

    I tested this plugin and JavaScript is possible to executed with content. That ...

    I tested this plugin and JavaScript is possible to executed with content.

    That makes experienced JavaScript coder to apple to add script to page that installs malware to visitor computer. OnLoad is possible out side body tag but that was not so easy...

  14. Aug 09, 2007

    Gangadhar says:

    HI, I have an external website I want to include that website to Confluence sea...

    HI,

    I have an external website I want to include that website to Confluence search. I mean some one search's on my Confluence. Results from external website should also prompt on the confluence search with content in confluance also. Can some let me know how I can achieve this.

    Thnaks in advance

  15. Oct 05, 2007

    Jing Liu says:

    Before I add Macro Security, this plugin works fine. After I add Macro Security ...

    Before I add Macro Security, this plugin works fine. After I add Macro Security following the instruction, I keep getting the error:

     I double checked that the group name in macro-security.properties file matches the group name in Confluence. We use Confluence 2.5.3.

     Do I miss anything? I appreciate your help.

    Jing

    1. Oct 05, 2007

      Bob Swift says:

      You didn't include the error message, so not quite sure what problem you are hav...

      You didn't include the error message, so not quite sure what problem you are having. Are you sure the page has a page level edit restriction to a group authorized in the properties file? And you restarted Confluence after change the properties file?

      1. Oct 08, 2007

        Jing Liu says:

        Thank you so much! The problem is resolved. I missed page level edit restric...

        Thank you so much! The problem is resolved. I missed page level edit restriction.

        I added the error message here in case other people encounter the same error as I did:

         html: Security restricted macro is not allowed on this page. A page edit restriction is required that matches the macro authorization list.

         Thanks again.

        Jing

  16. Nov 15, 2007

    Nana says:

    Hello, I want to show an image map on a confluence pag without using the image ...

    Hello,

    I want to show an image map on a confluence pag without using the image map plugin.

    so between the html tags I have a sample code such as

    <map name ='DG134266075">
              <AREA SHAPE=RECT COORDS="220,270,390,330"  HREF="bDOC.html"
               ALT=" :hello" TARGET="diagram">
            <AREA SHAPE=RECT COORDS="220,330,240,350"  HREF="javascript:open_window('cDOC.html')"
              ALT="hi"   TARGET="diagram">   <AREA SHAPE=RECT COORDS="240,330,260,350"  HREF="D78.html "
              ALT="hi"   TARGET="diagram"> 
              <AREA SHAPE=RECT COORDS="600,430,660,460"  HREF="blank_DOC.html"
               ALT=" :kiE" TARGET="diagram">
         
    </MAP>
    <DIV ALIGN=CENTER>Taxonomy <BR>
    <IMG SRC="DG134266075.jpg" USEMAP="#DG134266075" ALT= Taxonomy">
    </DIV>

    On saving the page, everything works nicely. However when i go to edit the page,  the tags are broken and it shows only the Alt and Target tags.

     This html plugin does not support HTML image map tags? or is there something else happening. Any help is appreciated.

    thanks

    Thanks