Found a solution here: http://mail.scipy.org/pipermail/ipython-user/2012-April/009838.html
Quoting the solution here for ref:
Brian Granger:
" Have the function return the raw HTML wrapped in an HTML object:
from IPython.core.display import HTML
...
...
def foo():
raw_html = "<h1>Yah, rendered HTML</h1>"
return HTML(raw_html)
"
Now calling foo() does give rich formatted html as I wanted.