Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bug: Double Apostrophe in <value> URI Formatting Issue

Aperta
#838 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
javascript
Ambito
tooling

Direzione di ricerca

Nell'issue non sono indicati né un file sorgente né un test. Inizia riproducendo l'esempio XML con Prettier e @prettier/plugin-xml, quindi individua il formatter XML e i relativi test di regressione esistenti. Il lavoro è completato quando le entità 6apos; adiacenti vengono formattate senza inserire uno spazio, preservando il comportamento segnalato per gli altri testi XML.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description:
I encountered a problem with the @prettier/plugin-xml plugin. When an XML file contains the text:

<value>&apos;&apos;</value>

Image

Prettier rewrites it as:

<value>
    &apos; &apos;
</value>

Image

This formatting adds an unwanted space between the apostrophes, which disrupts the appearance of our system.

Steps to Reproduce:

  1. Create an XML file with the following content:
    <root>
        <value>&apos;&apos;</value>
    </root>
    
  2. Run Prettier with the @prettier/plugin-xml plugin.
  3. Observe the formatted output.

Expected Behavior:
The content of the <value> tag should remain <value>&apos;&apos;</value> without adding spaces.

Actual Behavior:
The content of the <value> tag is rewritten as:

<value>
    &apos; &apos;
</value>

Additional Information:
In other cases, when there is only one apostrophe, Prettier formats correctly by keeping the line together:

<values>
    <field>ITA_IFM_ActivityDescription__c</field>
    <value xsi:type="xsd:string">MEDIA COMPLESSITA&apos;</value>
</values>

This leads us to believe it is a minor bug. Could you please provide feedback?

Prettier Configuration:

{
    "plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"],
    "printWidth": 600,
    "singleQuote": true,
    "trailingComma": "all",
    "bracketSpacing": false,
    "useTabs": true,
    "bracketSameLine": true,
    "apexInsertFinalNewline": false,
    "overrides": [
        {
            "files": "*.{trigger,cls}",
            "options": {"parser": "apex"}
        },
        {
            "files": "*.{apex}",
            "options": {"parser": "apex-anonymous"}
        },
        {
            "files": "**/lwc/**/*.html",
            "options": {"parser": "lwc"}
        },
        {
            "files": "*.{cmp,page,component,evt}",
            "options": {
                "parser": "html",
                "trailingComma": "none"
            }
        },
        {
            "files": "**/aura/**/*.js",
            "options": {"trailingComma": "none"}
        },
        {
            "files": "**/aura/**/*.{auradoc,design,app}",
            "options": {"parser": "angular"}
        },
        {
            "files": "**/*.xml",
            "options": {
                "parser": "xml",
                "useTabs": false,
                "tabWidth": 4,
                "xmlWhitespaceSensitivity": "preserve",
                "embeddedLanguageFormatting": "off",
                "xmlSelfClosingSpace": false
            }
        }
    ]
}

and this is our package.json

{
  "name": "***",
  "version": "1.0.0",
  "author": "***",
  "devDependencies": {
    "@prettier/plugin-xml": "^3.4.1",
    "prettier": "^3.4.2",
    "prettier-plugin-apex": "^2.2.2"
  },
  "repository": {
    "type": "****",
    "url": "****"
  },
  "scripts": {
    "prettier": "prettier"
  },
  "dependencies": {
    "sfdx-plugin-source-read": "^1.4.0"
  }
}

Thanks in advice, i'm here if you need anything else 😊

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di prettier/plugin-xml

Tutte le issue di prettier/plugin-xml

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.