title: How can I show only first x characters from a HTML code counting without tags
body: <p>I use a text editor that will generate a html code and I save in database that html code. 
  On another page I want to display first 100 characters only, but I don't want to count the html tags.</p>
  
  <p>For example I have this html code saved in db:</p>
  
  <pre><code>&lt;p&gt;&lt;span style="color:red; font-size:20px; font-family:Arial"&gt;
  Here is the real text that I want to strip to 100 characters&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Can be splited &lt;b&gt;between&lt;/b&gt; multiple divs. 
  Here is some more text to be longer &lt;p&gt;
  </code></pre>
  
  <p>If I substring as usual in javascript it will produce something like this:</p>
  
  <pre><code>&lt;p&gt;&lt;span style="color:red; font-size:20px; font-family:Arial"&gt;
  Here is the real text that I want to s
  </code></pre>
  
  <p>And this also broke the html code. </p>
  
  <p>What I want is to have like this:</p>
  
  <pre><code>&lt;p&gt;&lt;span style="color:red; font-size:20px; font-family:Arial"&gt;
  Here is the real text that I want to strip to 100 characters&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Can be splited &lt;b&gt;between&lt;/b&gt; multiple divs. 
  H&lt;p&gt;
  </code></pre>
  
  <p>I am using angular 4 for this project. So any idea using JS, angular, CSS, HTML or on the backend I have node.js will be helpfull. </p>