              # past other spans that might have already ended
              color = self.colors.get(entity["label"].upper(), self.default_color)
              span_slice = self.span_slice_template.format(
                  bg=color,
                  top_offset=top_offset,
              )
              span_slices.append(span_slice)
          return "".join(span_slices)
 
</s> remove         for entity, step in zip(entities, itertools.count(step=self.offset_step)):
 </s> add         for entity in entities:
            # rather than iterate over multiples of offset_step, we use entity['render_slot']
            # to determine the vertical position, since that tells where
            # the span starts vertically so we can extend it horizontally,
            # past other spans that might have already ended </s> remove                 bg=color, top_offset=self.top_offset + step
 </s> add                 bg=color,
                top_offset=top_offset, </s> remove                     ent["is_start"] = True if idx == span["start_token"] else False
 </s> add                     ent["is_start"] = span_start
                    if span_start:
                        # When the span starts, we need to know how many other
                        # spans are on the 'span stack' and will be rendered.
                        # This value becomes the vertical render slot for this entire span
                        span["render_slot"] = concurrent_spans
                    ent["render_slot"] = span["render_slot"]
            top_offset = self.top_offset + (
                self.offset_step * (entity["render_slot"] - 1)
            )
              # past other spans that might have already ended
              color = self.colors.get(entity["label"].upper(), self.default_color)
            top_offset = self.top_offset + (
                self.offset_step * (entity["render_slot"] - 1)
            )
              span_slice = self.span_slice_template.format(
                  bg=color,
                  top_offset=top_offset,
              )
              span_slices.append(span_slice)
          return "".join(span_slices)
keep add keep keep keep keep keep keep
 displaCy Spans Vertical Alignment Fix 2 (#11092)

* add in span render slot fix

* fix spacing off by one

* rm demo

* adjust comments

* fix whitespace and overlap issue 
spacy/displacy/render.py