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

Generated doctype is incorrect when using rstml/rsx #66

Open
johnbartholomew opened this issue Nov 18, 2024 · 0 comments
Open

Generated doctype is incorrect when using rstml/rsx #66

johnbartholomew opened this issue Nov 18, 2024 · 0 comments

Comments

@johnbartholomew
Copy link

The rstml generator uses string <! DOCTYPE to start the doctype. This puts Firefox into quirks mode (I suspect also in Chrome but I haven't been able to confirm). It needs to be <!DOCTYPE (without the extra space).

The generator code for it is here, I think:
https://github.com/vidhanio/hypertext/blob/b9d1d94766ecc4f1c4c3f13f663a41a3189a8b54/hypertext-macros/src/rstml.rs#L147C1-L147C29

Repro:

main.rs:

use hypertext::{html_elements, Rendered};

fn main() {
    const PAGE_HTML: Rendered<&str> = hypertext::rsx_static! {
        <!doctype html>
        <html><head><title>"Page"</title></head><body>"BODY"</body></html>
    };
    print!("{}", PAGE_HTML.as_str())
}

Generates output:

<! DOCTYPE html><html><head><title>Page</title></head><body>BODY</body></html>

Which when loaded in Firefox produces a quirks-mode warning in the debug console.

image

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

1 participant