Reduce html to n characters while keeping the formatting
This answer is no longer valid with the latest rule.

Javascript (ES6) 94 91

f=(s,l)=&gt;s.split(/(&lt;[^&gt;]+&gt;)/).map(x=&gt;x[0]=='&lt;'?x:[l--&gt;0?y:''for(y of x)].join('')).join('')




f('&lt;strong&gt;&lt;i&gt;more&lt;/i&gt; &lt;span style="color: red"&gt;complicated&lt;/span&gt;&lt;/strong&gt;', 7);
// '&lt;strong&gt;&lt;i&gt;more&lt;/i&gt; &lt;span style="color: red"&gt;co&lt;/span&gt;&lt;/strong&gt;'


Ungolfed:

f=(s,l)=&gt;
    s.split(/(&lt;[^&gt;]+&gt;)/). // split string s by &lt;*&gt;, capture group is spliced into the array 
    map(x=&gt; // map function to every item in the array
        x[0]=='&lt;'? // if first character is a &lt;
            x // don't modify the string
        : // else
            [ // array comprehension
                for(y of x) // for every character y in x
                    l--&gt;0? // if l &gt; 0 (and decrement l)
                        y // character y
                    : // else
                        '' // empty string 
            ].join('') // join characters in array
        ).
    join('') // join all strings in array