emanote
emanote copied to clipboard
<div></div> cannot used in raw HTML
Describe the bug
Placing a <div></div>
inside a block using ```{=html} in a emanote markdown file causes the following error:
div cannot contain text looking like its end tag
CallStack (from HasCallStack):
error, called at src/Text/XmlHtml/HTML/Render.hs:132:9 in xmlhtml-0.2.5.2-CTNpBEzbTM9I9R1TWdgm5i:Text.XmlHtml.HTML.Render
To Reproduce Steps to reproduce the behavior:
- Create the following markdown file
# Demo
Hello World
```{=html}
<div>
Hello World
</div>
\```
(Without the slash, GitHub's markdown makes the slash necessary).
- Run
emanote
Expected behavior The page renders two Hello Worlds.
Desktop (please complete the following information):
- Browser Firefox
- Version 91
Additional context The following code in xmlhtml seems to be relevant: https://github.com/snapframework/xmlhtml/blob/master/src/Text/XmlHtml/HTML/Render.hs#L133
This came up because I was trying to follow these instruction for embedding an Argdown component which include <div>
tags.
Oddly this happens only for div
tag. Any other tag will work. For example this works (no need to wrap in code block either),
<section>
Hello World
</section>
I was trying to follow these instruction for embedding an Argdown component
If you manage to get this working with Emanote (try with section
or <span class="block">
instead of div
), we can add it to the Tips section for the benefit of others (myself included)!
@Coda-Coda Do you have the HTML snippet for activating Argdown on code blocks on the HTML generated by Emanote? I can give it and try and make it work.
I can't figure out just from the Argdown docs as to what the raw embed code should be (it only talks about specific static site generators).
Oddly this happens only for
div
tag. Any other tag will work. For example this works (no need to wrap in code block either),
This happens because the raw html blocks are wrapped in a <div>
here: https://github.com/srid/heist-extra/blob/c5e6d869d67637d61aba11f8157c3ff882a5d3df/src/Heist/Extra/Splices/Pandoc/Render.hs#L63.
It was introduced in https://github.com/srid/emanote/pull/43 and the present bug report was expected back then.
#433 is somewhat related.