简体   繁体   English

如何自动修复嵌套标记页面的缩进?

[英]How to automatically fix the indentations of a nested markup page?

I got this markup on Emacs: 我在Emacs上获得了这个标记:

     <div class ...>
     <div class 2 ...>
<div class  ="modal fade" id="contactModal" tabindex="0" role="dialog">
           <div class    ="modal-dialog">
      <div class     ="modal-content">
  <form id   ="contactForm" class="form-horizontal" role="form" action="/contact"> 

Is there a simple way to format this code in Emacs by its hierarchy so that it will be more readable?, like so: 是否有一种简单的方法可以按其层次结构在Emacs中格式化此代码,使其更具可读性?例如:

<div class ...>
     <div class 2 ...>
        <div class  ="modal fade" id="contactModal" tabindex="0" role="dialog">
           <div class    ="modal-dialog">
             <div class     ="modal-content">
                <form id   ="contactForm" class="form-horizontal" role="form" action="/contact"> 

Mx indent-region , usually bound to <TAB> . Mx indent-region ,通常绑定到<TAB>

Works on regions, so you need to mark the part of document you want to indent, or Cx h to mark the whole buffer. 在区域上工作,因此您需要标记要缩进的文档部分,或Cx h标记整个缓冲区。

http://www.gnu.org/software/emacs/manual/html_node/elisp/Indentation.html http://www.gnu.org/software/emacs/manual/html_node/elisp/Indentation.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM