If I switch to HTML edit mode in confluence and write simple plain old HTML comments.. <!-- test 123 --> they get killed by confluence. This sucks!!
Is there a way to tell confluence to leave my HTML untouched??
Embed them in a code or noformat macro.
My colleague Jack Chen at Quest suggested using span instead of div. And this works GREAT! :)
IOW you can put the string
<span class="hidden">some comment here</span>
about everywhere in the XML text, it will be decently saved and won't alter the page layout.
Thanks Jack!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm... I feel like I remember span tags not working before, but maybe I was confused. Anyways, this would be the preferred method as it does not mess up the spacing. Glad to hear it worked!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems like Confluence filters out HTML comments from the XHTML source when saving it. One possibility is using div with a class of "hidden" (since Confluence doesn't filter out div tags) and insert your comment in that. Then you will have a comment that doesn't show in the editor but will show in the source editor.
Unfortunately there's no way I know of to customize the XHTML parser to not remove plain HTML comments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Div tags generate newlines.
I entered this text:
<p>Today will be a beautiful day</p> <p>Today is a <div class="hidden">before</div>beautiful day<div class="hidden">after</div></p> <p>Today was a beautiful day</p>
And here's the result:
Today will be a beautiful day
Today is a
beautiful day
Today was a beautiful day
<p>Today will be a beautiful day</p> <p>Today is a</p> <div class="hidden">before</div> <p>beautiful day</p> <div class="hidden">after</div> <p>Today was a beautiful day</p>
:(
Take 2: Using the HTML comment macro:
Getting this:
Today will be a beautiful day
Today is abeautifulday
Today was a beautiful day
<p>Today will be a beautiful day</p> <p>Today is a </p> <ac:structured-macro ac:macro-id="4c1b09e8-6bc4-4ca4-a86c-c9e6969f146d" ac:name="htmlcomment" ac:schema-version="1"> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p>before</p> </ac:rich-text-body> </ac:structured-macro> <p> beautiful </p> <ac:structured-macro ac:macro-id="ad3f6868-9c20-406f-89c8-e85db358c398" ac:name="htmlcomment" ac:schema-version="1"> <ac:parameter ac:name="hidden">true</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p>after</p> </ac:rich-text-body> </ac:structured-macro> <p> day</p> <p>Today was a beautiful day</p>
Loosing spaces/ Okay, I add spaces in the xml:
<p>Today is a </p> <ac:struct...-macro> <p> beautiful </p> <ac:struct...-macro> <p> day</p>
Result:
Today will be a beautiful day
Today is abeautifulday
Today was a beautiful day
They strip off the leading and trailing text spaces.
:( :(
So as a solution to replace html comments both div and macro are useless. And macro's add a lot of text bloat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or, put the HTML comment inside an HTML macro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another option would be to get the Content Formatting Macros (free). You get a HTML Comment macro with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you say HTML edit mode, do you mean using the Source Editor to look at the XHTML source?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.