
Notepad++可以正確縮排程式碼嗎?
如果我有這個:
<div><div><div></div></div> </div>
有沒有辦法把它變成下面的樣子?
<div>
<div>
<div>
</div>
</div>
</div>
答案1
您可以使用 TextFX 外掛程式為您重新縮排程式碼。如果您沒有它,則需要從插件管理器安裝。一旦到位>只需使用選單“TextFX”>“TextFX編輯”>“重新縮排C++程式碼”。
也許它不會轉換一行,但帶有缺失縮排的實際程式碼將得到很好的處理。
您將找到更多資訊和其他插件的解釋這裡。
答案2
安裝折疊縮進插入。它與 XML(或派生)標籤配合得很好。
答案3
我的所有程式碼都在一行上(縮小化的)。我所做的是使用線上“unminifier”將程式碼分成多行。有很多可用的,如果你搜尋Google,但這是最適合我的: http://mrcoles.com/blog/css-unminify/
然後我就用了這個插件@Magnum 提到(文字特效)進一步修飾程式碼中的縮排。結果太棒了!
前:
object(stdClass)#2 (1) { ["GetDocTypeListResult"]=> object(stdClass)#3 (1) { ["DocType"]=> array(14) { [0]=> object(stdClass)#4 (2) { ["id"]=> string(3) "180" ["name"]=> string(49) "Return Merchandise Authorization and Notification" } [1]=> object(stdClass)#5 (2) { ["id"]=> string(3) "810" ["name"]=> string(16) "Customer Invoice" } [2]=> object(stdClass)#6 (2) { ["id"]=> string(3) "816" ["name"]=> string(28) "Organizational Relationships" } [3]=> object(stdClass)#7 (2) { ["id"]=> string(3) "820" ["name"]=> string(31) "Payment Order Remittance Advice" } [4]=> object(stdClass)#8 (2) { ["id"]=> string(3) "824" ["name"]=> string(18) "Application Advice" } [5]=> object(stdClass)#9 (2) { ["id"]=> string(3) "830" ["name"]=> string(41) "Planning Schedule with Release Capability" } [6]=> object(stdClass)#10 (2) { ["id"]=> string(3) "840" ["name"]=> string(21) "Request for Quotation" } [7]=> object(stdClass)#11 (2) { ["id"]=> string(3) "846" ["name"]=> string(24) "Inventory Inquiry/Advice" } [8]=> object(stdClass)#12 (2) { ["id"]=> string(3) "850" ["name"]=> string(14) "Purchase Order" } [9]=> object(stdClass)#13 (2) { ["id"]=> string(3) "852" ["name"]=> string(21) "Product Activity Data" } [10]=> object(stdClass)#14 (2) { ["id"]=> string(3) "860" ["name"]=> string(47) "Purchase Order Change Request - Buyer Initiated" } [11]=> object(stdClass)#15 (2) { ["id"]=> string(3) "864" ["name"]=> string(12) "Text Message" } [12]=> object(stdClass)#16 (2) { ["id"]=> string(3) "945" ["name"]=> string(25) "Warehouse Shipping Advice" } [13]=> object(stdClass)#17 (2) { ["id"]=> string(3) "997" ["name"]=> string(26) "Functional Acknowledgement" } } } }
後:
object(stdClass)#2 (1) {
["GetDocTypeListResult"]=> object(stdClass)#3 (1) {
["DocType"]=> array(14) {
[0]=> object(stdClass)#4 (2) {
["id"]=> string(3) "180"
["name"]=> string(49) "Return Merchandise Authorization and Notification" }
[1]=> object(stdClass)#5 (2) {
["id"]=> string(3) "810"
["name"]=> string(16) "Customer Invoice" }
[2]=> object(stdClass)#6 (2) {
["id"]=> string(3) "816"
["name"]=> string(28) "Organizational Relationships" }
[3]=> object(stdClass)#7 (2) {
["id"]=> string(3) "820"
["name"]=> string(31) "Payment Order Remittance Advice" }
[4]=> object(stdClass)#8 (2) {
["id"]=> string(3) "824"
["name"]=> string(18) "Application Advice" }
[5]=> object(stdClass)#9 (2) {
["id"]=> string(3) "830"
["name"]=> string(41) "Planning Schedule with Release Capability" }
[6]=> object(stdClass)#10 (2) {
["id"]=> string(3) "840"
["name"]=> string(21) "Request for Quotation" }
[7]=> object(stdClass)#11 (2) {
["id"]=> string(3) "846"
["name"]=> string(24) "Inventory Inquiry/Advice" }
[8]=> object(stdClass)#12 (2) {
["id"]=> string(3) "850"
["name"]=> string(14) "Purchase Order" }
[9]=> object(stdClass)#13 (2) {
["id"]=> string(3) "852"
["name"]=> string(21) "Product Activity Data" }
[10]=> object(stdClass)#14 (2) {
["id"]=> string(3) "860"
["name"]=> string(47) "Purchase Order Change Request - Buyer Initiated" }
[11]=> object(stdClass)#15 (2) {
["id"]=> string(3) "864"
["name"]=> string(12) "Text Message" }
[12]=> object(stdClass)#16 (2) {
["id"]=> string(3) "945"
["name"]=> string(25) "Warehouse Shipping Advice" }
[13]=> object(stdClass)#17 (2) {
["id"]=> string(3) "997"
["name"]=> string(26) "Functional Acknowledgement" }
}
}
}
答案4
這整潔2插件正是你想要的。