Strange behavior when writing divs in a custom renderer #757

Open
opened 2026-01-29 14:44:52 +00:00 by claunia · 0 comments
Owner

Originally created by @minisbett on GitHub (Oct 18, 2025).

I have a custom renderer which, for demonstration purposes, writes something along the lines of this:

renderer.Write("""
  <a href="http:\\www.heise.de">
    <div style="display: flex; flex-direction: row; gap: 8px; align-items: center;">
      <div style="background: red;">Hello</div>
      <div style="background: green;">World</div>
    </div>
  </a>
  """);

However, in the rendered HTML, the very same code looks like this:
Image

It seems to

  1. Take the a-tag, and places it there, just completely empty.
  2. Takes the first div-tag in the a-tag, and places it on the root layer as well, then putting the a-tag inside, which then contains everything the div contained.

This seems very strange, and I've tried a lot, always running into this issue when using div-tags. Is this intended behavior? Something I am not aware of?

Originally created by @minisbett on GitHub (Oct 18, 2025). I have a custom renderer which, for demonstration purposes, writes something along the lines of this: ```html renderer.Write(""" <a href="http:\\www.heise.de"> <div style="display: flex; flex-direction: row; gap: 8px; align-items: center;"> <div style="background: red;">Hello</div> <div style="background: green;">World</div> </div> </a> """); ``` However, in the rendered HTML, the very same code looks like this: <img width="425" height="152" alt="Image" src="https://github.com/user-attachments/assets/8cfc37a0-4f3a-4b7d-a8b4-8c25338cd762" /> It seems to 1. Take the `a`-tag, and places it there, just completely empty. 2. Takes the first `div`-tag in the `a-tag`, and places it on the root layer as well, then putting the `a`-tag inside, which then contains everything the `div` contained. This seems very strange, and I've tried a lot, always running into this issue when using `div`-tags. Is this intended behavior? Something I am not aware of?
claunia added the invalid label 2026-01-29 14:44:52 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#757