How do I write HTML code instead of using WYSIWYG

Hi Team,

Its been 4 days I  joined a team which is using confluence to implement knowledge base.

I have got access as a space admin. I need to create some web pages in a space. 

I don't have an option of installing HTML macro Addons. Even the confluence admin does not have. 

How do I do coding in html. Is there anyway we can switch between design mode to source mode and write html and css code instead of using editor where I can't write html.

I am not sure about hosting. Is it something which can be resolved

pl help


2 answers

2 votes

Hello Bhavya, 

The HTML Macro is disabled by default in Confluence as it can expose the environment and make it vulnerable to cross-site scripting attacks.

warning Enabling these macros can make your Confluence site vulnerable to cross-site scripting attacks. You should only turn on these macros if you trust all your users not to attempt to exploit them. We strongly recommend leaving this macro disabled if you allow self-signed up or anonymous users to create content.


2 votes

Why do you want to write html in a tool that is designed to avoid you having to do it?

To "create web pages in a space", click "create" and put your knowledge base article in.  It's a web page as soon as you click "save".

Confluence is a tool built for collaboration and easy editing.  You don't have to learn to be an html coder to create good pages or documents.  You don't have to worry about the stray tags, having to encode things, getting the structure right - it's aimed at all levels of users simply being able to get on with their jobs and write stuff that can then be shared immediately.  It doesn't even store html, so even if you installed the "source editor", you wouldn't be editing html anyway.

The html macros can be handy for doing something unusual sometimes, but if you really want to write in html, then I'd recommend dumping Confluence and using an html editor with a web server.

Thank you Shawn and Nick for your quick reply.

I got your point. And understood the process now.

While creating the pages, I came across a situation where for few pages I need to put bit of javascript and add css style. 

So I was wondering if there is a way we can implement these pages like how we design web pages generally in websites development.

No, because it's not aimed at writing HTML, it's aimed at end users not needing to know html to use it. As Shawn has said, you can enable the (risky) html macros and do something in there, and I stick to my recommendation that you should *only* do that when you have snippets of stuff that can't be done in a plain editor - don't try to write whole pages, use it sparingly. CSS you would need to do in the space settings, if your theme allows for it, but that has a global effect across the space, so you need to be careful with it. Javascript, I strongly recommend staying well away from, as Confluence simply isn't built for you to inject arbitrary scripts into it and they make maintenance (especially upgrades) an absolute nightmare. Again, if you want to write in HTML, I'd stop using Confluence. If you want the odd snippet and can *completely* trust *all* your users to not write malformed html, then enable the html macros. Also consider all the formatting addons you can get from the marketplace - many of these are far better than abusing the html macros, and a lot of them are free. They have the advantage of not opening security holes, not letting your users break things with broken html, and they are a lot easier to use.

Thanks again Nic. I was just wondering to know more. Because confluence developer documentation has many things like user macros confluence connect framework working with SDK Writing own plugins

Yes, there's lots of development resources out there. It looks like you've already found the documentation I'd point you at though, so have a look through it. User macros in particular could be very helpful for you - if your reason for wanting to write html is "we have this bit of stuff we want to do in many confluence pages, but Confluence can't do it", then a user macro could solve it. If it's complex and interactive though, you're probably into writing a plugin (Connect is currently for Cloud services only, but will be in Server Confluences sometime in the future, and writing your own plugins is for Server version only)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Tuesday in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

205 views 2 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you