Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor February 09, 2024 Post a Comment If you'd like to see this implemented in the next version of VS, please vote for it here. Suppose the following horizontally lengthy HTML declaration: Solution 1: Well, I found a trick at the ASP.NET Forums:Positioning each attribute on a separate lineIt's not like the XAML feature described in my question but it works. In Options/Text Editor/HTML/Format you can check "Wrap tags when exceeding specific length" and set the length to 1. That will cause the formatter to wrap like crazy.Another option is:Go to TOOLS => Options... => Text Editor => XML => Formatting => Align attributes each on a separate line.Close the .cshtml file. Right click it in Solution Explorer and select Open With... then select XML (text) Editor. Select all content and do Ctrl + K then Ctrl + F.* This second option is tedious! :( Solution 2: If you feel brave, you can write an editor extension that does this for you. Take a look at the align extension that Noah wrote a while ago for ideas: https://github.com/NoahRic/AlignAssignmentsBaca JugaWhat Are The Steps I Need To Take To Add Nice Java Code Formatting To My Blogger/blogspot Blog?Format Html Code In Visual Studio Code Such That Attributes Are On Separate Lines?Html Formatting In RichtextboxSolution 3: This has been implemented in the new HTML editor in Visual Studio 2013 Preview, which has been released. This is a feature of the new editor only, which works for html and cshtml files, but not for aspx/ascx files. If you hit [return] after each value, the attributes will stack up under the first attribute definition. Format Document will not undo these changes anymore.Solution 4: Copy the html to the xml editor let it format it for you, then save it back to the html fileSolution 5: you can Find/Replace < with /n< + don't forget to click Use Regular Expressions setting Share You may like these postsParent Container Not Expanding To Child ElementsFix Formatting Of Aspx File In Visual Studio?Pretty Print Xml Data In JspHtml Formatting In Richtextbox Post a Comment for "Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor"
Post a Comment for "Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor"