Displaying HTML in webform

I’m creating HTML using the AI Agent, that I pass to HTML node to add tags. Viewed in the HTML node the HTML follows the style


THis is then sent to the Form (form end) node. The output is rendered at HTML but the styling is lost.

It looks like you have a few issues with the generated HTML.

  1. It appears to have markdown code block delimiters (3 back tics) on it still.
    • Strip those off with an expression like {{ $json.output.substring(3, $json.output.length-3) }}
  2. It appears to be a full html document, not just the content part, and you are embedding all of that within the body of another full html document. You probably need to insert only the inner html of the generated content’s <body> tag.
  • Currently
    ...snip...
    </head>
      <body>  
        {{ $json.output }}
        </div>
     </body>
     </html>
    
    … results in:
    ...snip...
    </head>
      <body>  
        ```<html>
          ...other generated content...
        </html>```
        </div> <!-- <<----- stray tag??? -->
     </body>
     </html>
    
  1. There appears to be an extra closing </div> tag in the static part of your html node. That could be messing up the html parsing/display too.