My goal is to write complete HTML in backend and just print in front end with handlebars
pub async fn new_test(
// path: web::Path,
config: web::Data,
handlebars: web::Data<Handlebars<'_>>,
) -> Result<HttpResponse, actix_web::Error> {
let db = &config.database_connection;
let x2: String = HtmlPage::new()
.with_title("My Page")
.with_header(1, "Main Content:")
.with_container(
Container::new(ContainerType::Article)
.with_attributes([("id", "article1")])
.with_header_attr(2, "Hello, World", [("id", "article-head"), ("class", "header")])
.with_paragraph("This is a simple HTML demo")
)
.to_html_string();
// println!("--------------------------------{:?}", html);
let x1 = r#"
<!doctype html>
Html parser
Hello world
"#;
let html = handlebars
.render(
"sample",
&json!({"o":x1,"x2":x2}),
)
.map_err(actix_web::error::ErrorInternalServerError)?;
Ok(HttpResponse::Ok()
.content_type(ContentType::html())
.body(html))
}
using this code I'm unable to create the content I want
The output is this ---> The HTML tags are also printed .
I want HTML tags to be hidden and execute only contents
my handlebar file is
Thanks in advance

