template.typ
// template.typ
#let template(
title: "Document",
lang: "en",
typstbody,
) = {
html.html(lang: lang)[
#html.head()[
#html.meta(
charset: "utf-8",
)
#html.title(title)
]
#html.body(
```html
<div class="container1 container2">
#typstbody
</div>
```
)
]
}
I am tring to insert the typst document body directly into a html element by using native html syntax.
Is this possible? Is there similar ways to do this?
// test.typ
#import "template.typ": *
#show: contents => template(contents)
= a level 1 heading
#lorem(10)
Y.D.X
2
This feature was requested in HTML reader · Issue #5890 · typst/typst · GitHub, but has not been implemented yet.
The current workaround is to load *.html as xml. The following is an example code.