There are several parsing options in parse5 that we may want to pass along to the user. For example a simple switch for document parsing or fragment parsing.
With document parsing this
becomes
<!DOCTYPE ><html><head></head><body><div>Hi</div></body></html>
With fragment parsing
<!DOCTYPE><html><head></head><body><div>Hi</div></body></html>
becomes
We could try some clever analysis of the input, but it would be better to just pass this level of control to the user.
Probably something like this.
{
tasks: [
{
markup: [
{
in: './partials/footer.html',
out: './dist/partials/footer.html',
fragment: true
}
]
}
]
}
My only concern is that right now we are barely using Parse5. Just to produce the HTML AST, and the to serialize it back to a string. So if we wanted to switch to a different library for added features, it would be mostly unnoticeable to users. The more features we adopt the harder it would be to change HTML parser down the road.
There are several parsing options in parse5 that we may want to pass along to the user. For example a simple switch for document parsing or fragment parsing.
With document parsing this
becomes
With fragment parsing
becomes
We could try some clever analysis of the input, but it would be better to just pass this level of control to the user.
Probably something like this.
My only concern is that right now we are barely using Parse5. Just to produce the HTML AST, and the to serialize it back to a string. So if we wanted to switch to a different library for added features, it would be mostly unnoticeable to users. The more features we adopt the harder it would be to change HTML parser down the road.