title: Get position from selected text in source HTML
body: <p>How to get position from selected text in HTML?</p>
  <p>the HTML content is rendered by setting innerHTML. For example <code>1.&amp;nbsp;&amp;nbsp;&amp;nbsp;2</code> is rendered <code>1.   2</code></p>
  <p>The use is then selecting 2 with text selector.</p>
  <pre><code>const start = document.getSelection().anchorOffset
  </code></pre>
  <p>is working fine to get me the position in rendered text. Which is 5 is this case.</p>
  <p>But is there some to get the position from HTML content (I think in this case it will be 20)</p>
  <p>By the way <a href="https://javascript.info/selection-range" rel="nofollow noreferrer">great article to learn selection</a></p>