Skip to content

feat: support option preserveSignificantWhitespace #479

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

Closed
wants to merge 0 commits into from

Conversation

kendrickw
Copy link
Contributor

@kendrickw kendrickw commented May 18, 2022

Fixes #478

Add new option preserveSignificantWhitespace, to preserve significant whitespace within XML elements. This PR should address all the cases where significant white space exists.

Specifically:

  • spaces within string are preserved:

    // before and after prettier identical
    <v>some string    extra space</v>
    
  • string with space(s) at the beginning and/or end:

    // before and after prettier identical
    <v>
      some  string
    </v>
    
  • mixing elements within string literal is also supported, space(s) surrounding and within string literal will be preserved:

    before: <v> some  string<abc/>more string </v>
     after: <v> some  string<abc />more string </v>
    

@kendrickw kendrickw force-pushed the feature/issue478 branch 2 times, most recently from 7c0190f to 4957d61 Compare May 19, 2022 17:29
@mrshmllow
Copy link

any news on getting this merged?

@kddnewton
Copy link
Member

@kendrickw a couple of things for getting this merged.

  • Can you rebase off the latest main branch?
  • Can you add this as an option for the whitespace sensitivity? It seems like this is just another option for that. This will be a breaking change, so we'll release it as a part of the next major, which will coincide with prettier v3.

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

Successfully merging this pull request may close these issues.

Preserve spacing in string literal within element
3 participants