New line added when using context="html" in sightly | Community
Skip to main content
New Participant
May 11, 2017
Solved

New line added when using context="html" in sightly

  • May 11, 2017
  • 2 replies
  • 2541 views

Hi All,

I am facing a really weird issue while trying to use context="html" in sightly.

I have a dialog property like this someproperty : "something<sub>2</sub>something"

HTML is <h1>${properties.someproperty @ context='html'}</h1>

Now, when rendered it adds a new line after the sub html tag. So it comes out as :

something2

something

I have tried few tags other than the sub tag as well and its the same behaviour for them as well.

The same thing works fine with context='unsafe'.

This is for AEM6.2 SP1. I have no idea whats wrong here ? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by HK1208

Hi All,

I found the problem. Posting the solution in case someone else lands on some similar problem.

The issue was we had an overridden xss config file in our AEM instance from one of the applications (multiple applications are deployed) i.e : /apps/cq/xssprotection/config.xml

Now this config had the following directive : <directive name="formatOutput" value="true"/>

which in turn causes some additional formatting and hence the line break. I changed it to : <directive name="formatOutput" value="false"/>

and everything worked fine. So in case, someone actually faces similar kind of issue, you know where to look :) 

2 replies

HK1208AuthorAccepted solution
New Participant
May 22, 2017

Hi All,

I found the problem. Posting the solution in case someone else lands on some similar problem.

The issue was we had an overridden xss config file in our AEM instance from one of the applications (multiple applications are deployed) i.e : /apps/cq/xssprotection/config.xml

Now this config had the following directive : <directive name="formatOutput" value="true"/>

which in turn causes some additional formatting and hence the line break. I changed it to : <directive name="formatOutput" value="false"/>

and everything worked fine. So in case, someone actually faces similar kind of issue, you know where to look :) 

edubey
New Participant
May 12, 2017

I tried on text field with value : something<sub>2</sub>something

and sightly: <h1>${properties.headline @ context='html'}</h1>

Output:

Works fine

Let me know If I am missing any point