Fix to only process text nodes

Smarter: will no longer incorrectly detect references. Now only searches for references in text nodes, rather than across raw HTML (previous version could detect in attributes, and would incorrectly replace these with HTML).