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.

Doesn't seem to format XML at all

See original GitHub issue

bracketSameLine

No response

printWidth

125

tabWidth

No response

xmlWhitespaceSensitivity

strict

xmlSelfClosingSpace

No response

Input XML

<svg viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<circle cx="25" cy="25" r="24.25" stroke="white" stroke-width="1.5"/>
<path d="M22.6606 33C29.4531 33 33.1683 26.8438 33.1683 21.5052C33.1683 21.3303 33.1683 21.1562 33.1575 20.9829C33.8803 20.4111 34.5042 19.7029 35 18.8918C34.326 19.2186 33.611 19.4329 32.8789 19.5274C33.6499 19.0225 34.2269 18.2284 34.5025 17.2928C33.7776 17.7635 32.9845 18.0951 32.1574 18.2735C31.6006 17.6258 30.8642 17.1969 30.0621 17.0532C29.2601 16.9095 28.4371 17.0589 27.7205 17.4785C27.0039 17.898 26.4337 18.5642 26.0981 19.374C25.7624 20.1838 25.6802 21.092 25.8639 21.958C24.3957 21.8775 22.9593 21.4601 21.6481 20.7329C20.3369 20.0057 19.1801 18.985 18.2528 17.7371C17.7805 18.6265 17.6359 19.6793 17.8483 20.6812C18.0607 21.6832 18.6143 22.5589 19.3962 23.1301C18.8084 23.1112 18.2335 22.9378 17.72 22.6244V22.6756C17.7202 23.6083 18.0154 24.5123 18.5554 25.2341C19.0954 25.9559 19.847 26.4512 20.6828 26.6359C20.1391 26.7981 19.5687 26.8218 19.0153 26.7052C19.2514 27.5078 19.7108 28.2098 20.3294 28.7128C20.948 29.2158 21.6949 29.4948 22.4655 29.5107C21.6998 30.1691 20.823 30.6559 19.8852 30.9433C18.9473 31.2306 17.9669 31.3128 17 31.1853C18.6889 32.3709 20.6539 32.9997 22.6606 32.9969"/>
</svg>

Current output XML

<svg viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<circle cx="25" cy="25" r="24.25" stroke="white" stroke-width="1.5"/>
<path d="M22.6606 33C29.4531 33 33.1683 26.8438 33.1683 21.5052C33.1683 21.3303 33.1683 21.1562 33.1575 20.9829C33.8803 20.4111 34.5042 19.7029 35 18.8918C34.326 19.2186 33.611 19.4329 32.8789 19.5274C33.6499 19.0225 34.2269 18.2284 34.5025 17.2928C33.7776 17.7635 32.9845 18.0951 32.1574 18.2735C31.6006 17.6258 30.8642 17.1969 30.0621 17.0532C29.2601 16.9095 28.4371 17.0589 27.7205 17.4785C27.0039 17.898 26.4337 18.5642 26.0981 19.374C25.7624 20.1838 25.6802 21.092 25.8639 21.958C24.3957 21.8775 22.9593 21.4601 21.6481 20.7329C20.3369 20.0057 19.1801 18.985 18.2528 17.7371C17.7805 18.6265 17.6359 19.6793 17.8483 20.6812C18.0607 21.6832 18.6143 22.5589 19.3962 23.1301C18.8084 23.1112 18.2335 22.9378 17.72 22.6244V22.6756C17.7202 23.6083 18.0154 24.5123 18.5554 25.2341C19.0954 25.9559 19.847 26.4512 20.6828 26.6359C20.1391 26.7981 19.5687 26.8218 19.0153 26.7052C19.2514 27.5078 19.7108 28.2098 20.3294 28.7128C20.948 29.2158 21.6949 29.4948 22.4655 29.5107C21.6998 30.1691 20.823 30.6559 19.8852 30.9433C18.9473 31.2306 17.9669 31.3128 17 31.1853C18.6889 32.3709 20.6539 32.9997 22.6606 32.9969"/>
</svg>

Expected output XML

<svg viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
   <circle cx="25" cy="25" r="24.25" stroke="white" stroke-width="1.5"/>
   <path d="M22.6606 33C29.4531 33 33.1683 26.8438 33.1683 21.5052C33.1683 21.3303 33.1683 21.1562 33.1575 20.9829C33.8803 20.4111 34.5042 19.7029 35 18.8918C34.326 19.2186 33.611 19.4329 32.8789 19.5274C33.6499 19.0225 34.2269 18.2284 34.5025 17.2928C33.7776 17.7635 32.9845 18.0951 32.1574 18.2735C31.6006 17.6258 30.8642 17.1969 30.0621 17.0532C29.2601 16.9095 28.4371 17.0589 27.7205 17.4785C27.0039 17.898 26.4337 18.5642 26.0981 19.374C25.7624 20.1838 25.6802 21.092 25.8639 21.958C24.3957 21.8775 22.9593 21.4601 21.6481 20.7329C20.3369 20.0057 19.1801 18.985 18.2528 17.7371C17.7805 18.6265 17.6359 19.6793 17.8483 20.6812C18.0607 21.6832 18.6143 22.5589 19.3962 23.1301C18.8084 23.1112 18.2335 22.9378 17.72 22.6244V22.6756C17.7202 23.6083 18.0154 24.5123 18.5554 25.2341C19.0954 25.9559 19.847 26.4512 20.6828 26.6359C20.1391 26.7981 19.5687 26.8218 19.0153 26.7052C19.2514 27.5078 19.7108 28.2098 20.3294 28.7128C20.948 29.2158 21.6949 29.4948 22.4655 29.5107C21.6998 30.1691 20.823 30.6559 19.8852 30.9433C18.9473 31.2306 17.9669 31.3128 17 31.1853C18.6889 32.3709 20.6539 32.9997 22.6606 32.9969"/>
</svg>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kddnewtoncommented, Nov 30, 2021

No worries, glad it’s working!

0reactions
aldrichdevcommented, Nov 30, 2021

Apologies, I just now realized why this wasn’t working; the folder my SVGs were in were included in .prettierignore. So the solution was:

  1. Remove that directory from .prettierignore
  2. Add "xmlWhitespaceSensitivity": "ignore" to .prettierrc

And now it is indenting! Closing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I format XML in Notepad++?
Try Plugins -> XML Tools -> Pretty Print (libXML) or (XML only - with line breaks Ctrl + Alt + Shift + B...
Read more >
Format document does not work at least on xml files #17604
Steps to Reproduce: Open Xml File; Format Document; You'll get the WARN Cannot read property 'substring' of undefined.
Read more >
Problems with formatting xml files
When I am asking IDEA to format my xml files, it does not work, that is, no lines are changed. It has been...
Read more >
This XML file does not appear to have any style information ...
Watch This XML file does not appear to have any style information associated with it, Computers Videos on TeacherTube.
Read more >
Why is some of my text not formatted correctly in xml?
1. The attributes controlling your formatting aren't carried over correctly into your XML. · 2. The attributes are there or there are none...
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