Code Monkey home page Code Monkey logo

Comments (6)

zr40 avatar zr40 commented on June 3, 2024 1

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.

from maud.

lambda-fairy avatar lambda-fairy commented on June 3, 2024

Hi, would you like to give a minimal example?

Maud doesn't minify. So I'm not sure how you're seeing this behavior.

from maud.

zr40 avatar zr40 commented on June 3, 2024

@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.

from maud.

FallBackITA27 avatar FallBackITA27 commented on June 3, 2024

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.

from maud.

FallBackITA27 avatar FallBackITA27 commented on June 3, 2024

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

from maud.

FallBackITA27 avatar FallBackITA27 commented on June 3, 2024

Huh. I'll look into it on my own, absolutely 0 idea on why the output isn't the same.

from maud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.