question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for XML / SVG

See original GitHub issue

It would be great if prettier could also check and format XML and SVG files.

The formatting rules would be exactly the same as for JSX.

Specificly for SVG, the contents of a <style /> tag would be formatted as CSS.

#3491 was marked as a duplicate of #1882, but #1882 is only about HTML, not XML.

Input:

<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120">
<defs ><style>.foo {color: cyan}</style></defs>
    <rect fill="#e8e8e8" height="108" rx="12" width="108" x="0" y="4"></rect>
  </svg>

Output:

N/A

Expected behaviour:

<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120">
  <defs>
    <style>
      .foo {
        color: cyan;
      }
    </style>
  </defs>
  <rect fill="#e8e8e8" height="108" rx="12" width="108" x="0" y="4" />
</svg>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:134
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

38reactions
kddnewtoncommented, Aug 4, 2020

Opened the PR!

36reactions
tjx666commented, Sep 19, 2020

any progress?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG, graphics in XML for the Web - Xul.fr
SVG, Scalable Vector Graphic, is a specification of documents to describe scalable 2D graphics in XML. It is compatible with XML 1.0.
Read more >
xml:space - SVG: Scalable Vector Graphics - MDN Web Docs
SVG supports the built-in XML xml:space attribute to handle whitespace characters inside elements. Child elements inside an element may also ...
Read more >
Introduction — SVG 2 - W3C
SVG is a language for describing two-dimensional graphics. As a standalone format or when mixed with other XML, it uses the XML syntax...
Read more >
Editing SVG Files - Oxygen XML Editor
Oxygen XML Editor uses the Apache Batik open source library to render SVG images and it only has partial support for SVG 1.2....
Read more >
HTML SVG Graphics - W3Schools
SVG defines vector-based graphics in XML format. What is SVG? SVG stands for Scalable Vector Graphics; SVG is used to define graphics for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found