I am trying to write jade to output the following html:
<p class="para">
This is my post.content.brief text
<img src="my_image.png"/>
</p>
The post.content.brief variable must be escaped properly. Here is what jade I have so far (non-working):
p.para
img(src=my_image.png)
!= post.content.brief
The issue is it gives me this html which isnt nested correctly:
<p class="para">
<img src="my_image.png">
</p>
<p>This is my post.content.brief text</p>
I found the issue. The post.content.brief variable contained the string "<p>This is text</p>"
. It was placing it inside another <p></p>
tag which was causing issues.
To solve the problem all I needed to do was use the following Jade code:
div.para
img(src=my_image.png)
!= post.content.brief