Closed
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
hast-util-to-html@9.0.2
Link to runnable example
No response
Steps to reproduce
Run the code below.
import { toHtml } from "hast-util-to-html";
console.log(toHtml(
{
type: "root",
children: [
{
type: "element",
tagName: "html",
children: [
{
type: "element",
tagName: "head",
children: [],
},
{
type: "element",
tagName: "body",
children: [],
},
],
},
],
},
{ omitOptionalTags: true },
));
Expected behavior
Empty output. The start tag of the head
element is omitted because the element is empty.
Actual behavior
The output is <head>
.
Affected runtime and version
node@22.8.0
Affected package manager and version
npm@10.8.3
Affected OS and version
No response
Build and bundle tools
No response