Skip to content

Pretty formatted output for xml files #196

@VaasuDevanS

Description

@VaasuDevanS

Hi. How to achieve a pretty formatted output for xml files using this plugin? I tried configuring the plugin's settings but nothing seem to output the way I want.

$ dprint --version
dprint 0.51.1

Below is my dprint.json file

{
  "markup": {
  },
  "excludes": [],
  "plugins": [
    "https://plugins.dprint.dev/g-plane/markup_fmt-v0.25.3.wasm"
  ]
}

Example xml file

<?xml version="1.0"?><catalog><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating applications 
      with XML.</description></book><book id="bk102"><author>Ralls, Kim</author><title>Midnight Rain</title><genre>Fantasy</genre><price>5.95</price><publish_date>2000-12-16</publish_date><description>A former architect battles corporate zombies, 
      an evil sorceress, and her own childhood to become queen 
      of the world.</description></book></catalog>

dprint's output

<?xml version="1.0"?><catalog><book id="bk101"><author
    >Gambardella, Matthew</author><title>XML Developer's Guide</title><genre
    >Computer</genre><price>44.95</price><publish_date
    >2000-10-01</publish_date><description
    >An in-depth look at creating applications
      with XML.</description></book><book
    id="bk102"
  ><author>Ralls, Kim</author><title>Midnight Rain</title><genre
    >Fantasy</genre><price>5.95</price><publish_date
    >2000-12-16</publish_date><description
    >A former architect battles corporate zombies,
      an evil sorceress, and her own childhood to become queen
      of the world.</description></book></catalog>

Expected output

<?xml version="1.0"?>
<catalog>
    <book id="bk101">
        <author>Gambardella, Matthew</author>
        <title>XML Developer's Guide</title>
        <genre>Computer</genre>
        <price>44.95</price>
        <publish_date>2000-10-01</publish_date>
        <description>An in-depth look at creating applications 
      with XML.</description>
    </book>
    <book id="bk102">
        <author>Ralls, Kim</author>
        <title>Midnight Rain</title>
        <genre>Fantasy</genre>
        <price>5.95</price>
        <publish_date>2000-12-16</publish_date>
        <description>A former architect battles corporate zombies, 
      an evil sorceress, and her own childhood to become queen 
      of the world.</description>
    </book>
</catalog>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions