Super User is a question và answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Bạn đang xem: Html
Sign up khổng lồ join this community





Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.

Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to lớn search.
Learn moreIs there an HTML auto-indentation feature or plugin for Sublime Text (aka prettify/beautify/format)?
For example, something to lớn change:
to:
...that works on full pages & snippets.
The built in Edit > Line > Reindent setting doesn"t do thisThe plugin HTMLTidy adds head and body tags, so it doesn"t work for partials, it also has various other issuesgist.github.com/mcdonc/3898894 claims to vị it, but requires Emacs(Notepad++ had auto-indent, Dreamweaver had Apply Source Formatting, Aptana has Format, etc.)
The Tag plugin handles inline tags incorrectly, for example using it on this snippet:
foobarbazqux
results in:
foo bar baz qux
html sublime-text-2 autoindent
chia sẻ
Improve this question
Follow
edited Dec 16, 2013 at 20:36
Dirk Diggler
asked Mar 11, 2013 at 14:52
Dirk DigglerDirk Diggler
34211 gold badge22 silver badges77 bronze badges
5
địa chỉ a bình luận |
3 Answers 3
Sorted by: Reset to default
Highest score (default) Date modified (newest first) Date created (oldest first)
18
The reindent doesn"t always work for snippets. You can use the Tag plugin(install from package control). Then just press ctrl+shift+p, & type tag. You"ll see the option Auto-Format tags on document. Select và press Enter. That"ll bởi vì it.
mô tả
Improve this answer
Follow
edited Mar 25, 2013 at 19:04
Dirk Diggler
34211 gold badge22 silver badges77 bronze badges
answered Mar 15, 2013 at 19:01
BibhasBibhas
2,55422 gold badges1717 silver badges2121 bronze badges
6
| Show 1 more phản hồi
8
Select All -> Edit thực đơn -> Line -> Reindend will do. You could mix a shortcut combination for the same use.
Xem thêm: Thẻ Ân Xá Liên Minh Huyền Thoại, Profile Picture, Thẻ Ân Xá Garena
"keys": <"ctrl+shift+r">, "command": "reindent" , "args": "single_line": false
giới thiệu
Improve this answer
Follow
edited May 23, 2017 at 12:41
CommunityBot
1
answered Jun 9, năm trước at 10:20
Jasim MahmoodJasim Mahmood
8111 silver badge11 bronze badge
4
add a phản hồi |
0
In order for the Reindent feature to lớn work, you have khổng lồ uncheck the option for "Indent Using Spaces":
View >> Indentation >> Indent Using Spaces
Once this option has been unchecked, you can select your text & Reindent:
Edit >> Line >> Reindent
This will work for HTML syntax as well as XML. Not tested it on any others.
chia sẻ
Improve this answer
Follow
answered Jun 18, 2016 at 12:25
SidzSidz
111 bronze badge
1
showroom a phản hồi |
Your Answer
Thanks for contributing an answer khổng lồ Super User!
Please be sure to answer the question. Provide details & share your research!But avoid …
Asking for help, clarification, or responding khổng lồ other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.
Draft saved
Draft discarded
Sign up or log in
Sign up using Google
Sign up using Facebook
Sign up using email and Password
Submit
Post as a guest
Name
email Required, but never shown
Post as a guest
Name
thư điện tử
Required, but never shown
Post Your Answer Discard
By clicking “Post Your Answer”, you agree khổng lồ our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged html sublime-text-2 autoindent or ask your own question.
The Overflow Blog
Featured on Meta
Linked
2
Formatting or beautifying javascript in SublimeText
Related
1
html indentation for css, html in emacs
5
auto-close HTML tags in Sublime Text
4
Is there a Outline (or OPML) plugin for Sublime Text 2?
1
sublime text 2: tự động hóa format php?
1
Sublime Text 2: Ruby Markers plugin error
1
Sublime Text 2 not auto-completing some methods
4
Is there a plugin for default file location in sublime text 2?
2
Is there a Sublime Text plugin that favours frequently opened files when using 'Goto Anything'?
Hot Network Questions more hot questions
Question feed
Subscribe to lớn RSS
Question feed to subscribe lớn this RSS feed, copy & paste this URL into your RSS reader.
lang-html
Super User
Company
Stack Exchange Network
Site design / biểu tượng logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. Rev2022.4.21.42004
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device & disclose information in accordance with our Cookie Policy.