Truncate HTML code to limit its length by number of words without losing markup.