How can I prevent a custom block from rewriting HTML?
Try going to Admin menu &gt; Configuration &gt; Content authoring &gt; Text formats and editors then edit yours (E.g. &quot;basic html&quot;)
Down towards the bottom you should see an option: Correct faulty and chopped off HTML - uncheck that option and save.
Not sure why a widget would expect an un-closed &lt;div /&gt; tag though.