HypertextLiteral.jl
HypertextLiteral.jl copied to clipboard
FR: Support `<!doctype>`
I am using HypertextLiteral to generate the entire contents of an HTML file, but HypertextLiteral.jl won't let me write <!doctype html>
or <!DOCTYPE html>
on the first line:


This is not a bug, but a nice-to-have :)
This shouldn't be difficult, but it's likely to be tedious. It's a non-breaking change to add this feature, so, I don't think there is any urgency to it. We're open to pull requests.
is there a workaround for now?
Hmm. I'll see if I can make progress on it.
One workaround is:
import Base
struct WithDoctype
x
end
function Base.show(io::IO, m::MIME"text/html", wd::WithDoctype)
write(io, "<!doctype html>\n")
show(io, m, wd.x)
end
mypage = @htl("""
<html>
...
</html>
""") |> WithDoctype