bram209 / leptosfmt

A formatter for the leptos view! macro
Apache License 2.0
272 stars 29 forks source link

Leptosfmt adds stray space in html shell (needed for leptos-0.7*) #146

Closed spencewenski closed 2 months ago

spencewenski commented 2 months ago

Context

In leptos-0.7 we can (need to?) provide a custom "app shell". This typically looks something like:

pub fn shell(options: LeptosOptions) -> impl IntoView {
    view! {
        <!DOCTYPE html>
        <html lang="en"></html>
    }
}

See also many of the examples, e.g. the hackernews_axum example.

Bug

The issue I'm seeing is leptosfmt is adding a space (`) after the<!DOCTYPE html>. This then causescargo fmt --all --checkto fail due to the trailing whitespace. E.g, the example above becomes (note the trailing `):

pub fn shell(options: LeptosOptions) -> impl IntoView {
    view! {
        <!DOCTYPE html> 
        <html lang="en"></html>
    }
}

If I try running cargo fmt after leptosfmt, then leptosfmt --check fails because it expects the trailing whitespace.