IssueRaiser

Support for XML / SVG

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 <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 <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> ```

Posted by remcohaszing on Nov 1, 2018, 10:06 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments

support (Other)

Support for XML / SVG

remcohaszingNov 1, 2018, 10:06 AM

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 <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 <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> ```

Comments (0)

No comments yet. Start the discussion.

Comment on this issue