Issues with n8n HTML creation

Describe the problem/error/question

generateHtmlTemplate node renders HTML content properly, somewhere between there and the binary creation it loses the formatting and is viewed as straight text instead of rendered HTML elements.

No error Messages

Please share your workflow

Heres the outputted HTML

<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body><table><tr><td data-t="s" data-v="html" id="sjs-A1">html</td></tr><tr><td data-t="s" data-v="&lt;html&gt;<br/>&lt;head&gt;<br/>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br/>  &lt;title&gt;My HTML document&lt;/title&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>  &lt;div class=&quot;container&quot;&gt;<br/>    &lt;h1&gt;This is an H1 heading&lt;/h1&gt;<br/>    &lt;h2&gt;This is an H2 heading&lt;/h2&gt;<br/>    &lt;p&gt;This is a paragraph&lt;/p&gt;<br/>  &lt;/div&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;<br/><br/>&lt;style&gt;<br/>.container {<br/>  background-color: #ffffff;<br/>  text-align: center;<br/>  padding: 16px;<br/>  border-radius: 8px;<br/>}<br/><br/>h1 {<br/>  color: #ff6d5a;<br/>  font-size: 24px;<br/>  font-weight: bold;<br/>  padding: 8px;<br/>}<br/><br/>h2 {<br/>  color: #909399;<br/>  font-size: 18px;<br/>  font-weight: bold;<br/>  padding: 8px;<br/>}<br/>&lt;/style&gt;" id="sjs-A2">&lt;html&gt;<br/>&lt;head&gt;<br/>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br/>  &lt;title&gt;My HTML document&lt;/title&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>  &lt;div class=&quot;container&quot;&gt;<br/>    &lt;h1&gt;This is an H1 heading&lt;/h1&gt;<br/>    &lt;h2&gt;This is an H2 heading&lt;/h2&gt;<br/>    &lt;p&gt;This is a paragraph&lt;/p&gt;<br/>  &lt;/div&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;<br/><br/>&lt;style&gt;<br/>.container {<br/>  background-color: #ffffff;<br/>  text-align: center;<br/>  padding: 16px;<br/>  border-radius: 8px;<br/>}<br/><br/>h1 {<br/>  color: #ff6d5a;<br/>  font-size: 24px;<br/>  font-weight: bold;<br/>  padding: 8px;<br/>}<br/><br/>h2 {<br/>  color: #909399;<br/>  font-size: 18px;<br/>  font-weight: bold;<br/>  padding: 8px;<br/>}<br/>&lt;/style&gt;</td></tr></table></body></html>

Information on your n8n setup

n8n running in docker on VPS behind traefik proxy. n8n is 1.94.1

1 Like

Hey,

It seems because you have already formatted into html, you don;t need to use convert to html, simplle just convert to text file, and choose output name.

Like this,

Does this work?

If I download, it shows perfectly in browser.

In the next node, now you can call data and should be all okay. Please let me know if this fixes it. :slight_smile:

Best regards,

Samuel

1 Like

Thanks samuel, that fixed it perfectly. Is this due to how n8n handles the line breaks in the code?

I was having the hardest time, thanks very much

Jacob

@jkkicks Your welcome, id appricate if you can mark as solution that reply as the solution.

It’s because it’s already convert into html, so no need to convert it again if the genhtml has already done it :slight_smile:

Have a great day, thanks,

Samuel

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.