Closed FallBackITA27 closed 7 months ago
Hi, would you like to give a minimal example?
Maud doesn't minify. So I'm not sure how you're seeing this behavior.
@FallBackITA27 If you're using the browser's inspector rather than 'view source', you're seeing the resulting DOM, not the input HTML. Insignificant whitespace is stripped by the browser's HTML parser before appearing in the DOM.
Insignificant whitespace is stripped by the browser's HTML parser before appearing in the DOM.
Nope, it's made into text nodes which are visible to the user and you can actually interact, depending on the tag.
You can actually see this by logging child nodes on an indented element.
Hi, would you like to give a minimal example?
fn build() {
let x = maud::html {
head { title { "test" } };
body {
p { "Shroomstrat: " };
};
}.to_string();
std::fs::write("./t.html", x.as_bytes()).unwrap();
}
The result is as stated above, where the content of p, meaning that space, is removed. I'm unsure if the example works, I just winged it
Changing your example as follows to fix the errors:
fn build() {
let x = maud::html! {
head { title { "test" } };
body {
p { "Shroomstrat: " };
};
}
.into_string();
std::fs::write("./t.html", x).unwrap();
}
This creates the following output file:
<head><title>test</title></head><body><p>Shroomstrat: </p></body>
Note that the space is not removed.
Huh. I'll look into it on my own, absolutely 0 idea on why the output isn't the same.
p {"values: "}
-><p>values:</p>
This is obviously an issue. Minifying code is fine, but against user input is painful to deal with.