如何格式化“一行html"作为 sublime 中的漂亮文档? [英] How to format "one line html" as a pretty document in sublime?

查看:32
本文介绍了如何格式化“一行html"作为 sublime 中的漂亮文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅包含一行的 html 源文件,如下所示:

I have a html source file containing only one line like the following:

<html><head>test</head><body>wow</body></html>

,我想将其格式化如下:

, and I want to format it as following:

<html>
    <head>
        test
    </head>
    <body>
        wow
    </body>
</html>

,我使用了命令:Edit-> Line-> Reindent 但它不起作用.

, I have used the command: Edit-> Line-> Reindent but it doesn't work.

推荐答案

在 Sublime Text 中试试这个:

In Sublime Text try this:

  1. 突出显示第一个标签中的最后一个字符:>"
  2. 使用 Find > Quick Add Next(Command+D 在 Mac 上或 Ctrl+D 在 PC 上)
  1. Highlight the last character in the first tag: ">"
  2. Use Find > Quick Add Next (Command+D on Mac or Ctrl+D on PC)

您现在将在多个选择中突出显示所有匹配项,将插入符号移动到标签的末尾并按回车键插入您需要的所有新行.

You'll now have all occurrences highlighted in multiple selections, move the caret to the end of the tag and hit return to insert all the new lines you require.

祝你好运

这篇关于如何格式化“一行html"作为 sublime 中的漂亮文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆