Whitespace is incorrectly preserved when `xmlWhitespaceSensitivity` is set to `ignore`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- tooling
Direzione di ricerca
Cerca nell’implementazione del plugin XML xmlWhitespaceSensitivity e la gestione attuale basata su String#trim o \s. Riproduci il comportamento con testo XML contenente tabulazioni, interruzioni di riga, spazi e i caratteri di spazio non XML elencati. È completato quando, con la sensibilità impostata su ignore, vengono rimossi solo tabulazione, nuova riga, ritorno a capo e spazio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
According to the XML specification, only \t, \n, \r, and (space character) are considered whitespace and are affected by the xml:space attribute. As it has been already raised in #768, the plugin used String#trim() to remove whitespace characters, affecting also other non-XML whitespace characters:
- U+00A0 No-Break Space
- U+1680 Ogham Space Mark
- U+2000 En Quad
- U+2001 Em Quad
- U+2002 En Space
- U+2003 Em Space
- U+2004 Three-Per-Em Space
- U+2005 Four-Per-Em Space
- U+2006 Six-Per-Em Space
- U+2007 Figure Space
- U+2008 Punctuation Space
- U+2009 Thin Space
- U+200A Hair Space
- U+2028 Line Separator
- U+2029 Paragraph Separator
- U+202F Narrow No-Break Space
- U+205F Medium Mathematical Space
- U+3000 Ideographic Space
- U+FEFF Zero Width No-Break Space
This issue has been fixed in 6170e95. However, the fix still affects most of the characters mentioned above due to the usage of the \s character class and the issue described originally in #768 still persists.
Probably the easiest way to fix the issue is to replace the \s character class with the (space character):
const content = chardata.TEXT.replaceAll(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
- Lingua principale
- JavaScript
- Stelle
- 278
- Fork
- 46
- Merge medio
- 1m
- PR unite (30g)
- 13
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di prettier/plugin-xml
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
prettier/plugin-xml#996 ·
-
Incorrect indentation with xmlWhitespaceSensitivity "preserve" inside a sibling of a text node Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
prettier/plugin-xml#995 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
prettier/plugin-xml#986 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
prettier/plugin-xml#981 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
prettier/plugin-xml#937 · 1 reazione ·
Tutte le issue di prettier/plugin-xml
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
web-platform-tests/interop#1455 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
corsairdev/corsair#1764 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100