Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Support <!doctype> #21

Open
fonsp opened this issue Nov 22, 2021 · 4 comments
Open

FR: Support <!doctype> #21

fonsp opened this issue Nov 22, 2021 · 4 comments

Comments

@fonsp
Copy link
Member

fonsp commented Nov 22, 2021

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:

Schermafbeelding 2021-11-22 om 18 34 40

Schermafbeelding 2021-11-22 om 18 34 53

This is not a bug, but a nice-to-have :)

@clarkevans
Copy link
Collaborator

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.

@schlichtanders
Copy link

is there a workaround for now?

@clarkevans
Copy link
Collaborator

Hmm. I'll see if I can make progress on it.

@fonsp
Copy link
Member Author

fonsp commented Mar 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants