blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

Is it possible to not wrap <div> inside <a> in <p>

Open inliquid opened this issue 4 years ago • 0 comments

As of HTML 5 wrapping block element in <a> is valid HTML.

However this renderer breaks a construction with <a> links, because they will be wrapped in <p>:

MD input:

<a href="/asset/upload/post/2713/789f4b70fb52b581274758966463dd7b.zip" target="_blank"><div class="file-icon file-icon-xl" data-type="zip"></div></a>

HTML output:

<p><a href="/asset/upload/post/2713/789f4b70fb52b581274758966463dd7b.zip" target="_blank" rel="nofollow noopener"><div class="file-icon file-icon-xl" data-type="zip"></div></a></p>

And as a result browser will break everything by parsing it as:

<p><a href="/asset/upload/post/2713/789f4b70fb52b581274758966463dd7b.zip" target="_blank" rel="nofollow noopener"></a></p><div class="file-icon file-icon-xl" data-type="zip"></div><p></p>

Is there a way to make renderer not add <p> around <div> inside <a>?

inliquid avatar Jul 16 '21 12:07 inliquid