lib/utils/html.js
function tokenize(content) {
    var tokens = [];
    var parser = new htmlparser.Parser({
        onopentag: function(name, attribs) { },
        ontext: function(text) {
            var start = parser.startIndex;

            tokens.push({
                value: text,
                index: start,
                offset: text.length
            });
        },
        onclosetag: function(tagname) { }
    });
    parser.write(content);
    parser.end();

    return tokens;
}
function tokenize(content) {
    var tokens = [];
    var parser = new htmlparser.Parser({
        onopentag: function(name, attribs) { },
        ontext: function(text) {
            var start = parser.startIndex;

            tokens.push({
                value: text,
                index: start,
                offset: text.length
            });
        },
        onclosetag: function(tagname) { }
    });
    parser.write(content);
    parser.end();

    return tokens;
}
Tokenize some html content to return tokens of text