index: add conditional encoding of text nodes

Add conditional encoding of text nodes as [w3c says].(http://www.w3.org/html/wg/drafts/html/master/syntax.html#serializing-html-fragments)