title: LineBackgroundSpan: PARAGRAPH span must start at paragraph boundary Error
body: <p>I am trying to apply rounded corners to my code tags in a given string</p>
  <p>My string looks like this :</p>
  <pre><code>This is a test &lt;br/&gt;&lt;br/&gt; &lt;code&gt; Some code block here &lt;/code&gt;
  </code></pre>
  <p>I want to apply the <a href="https://medium.com/@Semper_Viventem/simple-implementation-of-rounded-background-for-text-in-android-60a7706c0419" rel="nofollow noreferrer">CustomLineBackgroundSpan</a> (for rounded corners) to only the text between the <code>code</code> tags using a <code>TagHandler</code></p>
  <pre><code>class TagHandler() : Html.TagHandler {
      override fun handleTag(opening: Boolean, tag: String, output: Editable, xmlReader: XMLReader) {
          when (tag) {
              CODE_TAG -&gt; handleCodeTag(opening, output)
          }
      }
     
  
      private fun handleCodeTag(opening: Boolean, output: Editable) = when {
          opening -&gt; {
              start(output, CodeItem())
          }
          else -&gt; {
               // just applies the span based on start and end index of the marker
               end&lt;CodeItem&gt;(
                  output,
                  // basic sample
                  LineBackgroundSpan.Standard(Color.LTGRAY)
              )
          }
      }
  </code></pre>
  <p>But the above setup doesnt seem to work for all kinds of strings.</p>
  <p>Some strings ex: <code>This is a test &lt;br/&gt;&lt;br/&gt; &lt;code&gt; Some code block here &lt;/code&gt; some more text</code> fail with
  <code>PARAGRAPH span must start at paragraph boundary (5 follows  )</code></p>
  <p>How can I resolve this ?</p>