是否有用于在 Atom 编辑器中格式化 HTML 的命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24189068/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:02:07  来源:igfitidea点击:

Is there a command for formatting HTML in the Atom editor?

htmlatom-editorcode-formatting

提问by user376456

I would like to format my HTML with a command, as I do in Visual Studio, using Ctrl+K+D. Is this possible in Atom? If not, are there other options?

我想格式化我的HTML的命令,因为我在Visual Studio中一样,用Ctrl+ K+ D。这在Atom 中可能吗?如果没有,还有其他选择吗?

回答by Stuart Hallows

Atom does not have a built-in command for formatting html. However, you can install the atom-beautifypackage to get this behavior.

Atom 没有用于格式化 html 的内置命令。但是,您可以安装atom-beautify包来获得此行为。

  1. Press CTRL+ SHFT+ Pto bring up the command palette (CMD+ SHFT+ Pon a Mac).
  2. Type Install Packagesto bring up the package manager.
  3. Type beautifyinto the search box.
  4. Choose atom-beautifyor one of the other packages and click Install.
  5. Now you can use the default keybinding for atom-beautify CTRL+ ALT+ Bto beautify your HTML (CTRL+ OPTION+ Bon a Mac).
  1. CTRL+ SHFT+P以弹出命令调色板(CMD+ SHFT+P在Mac)。
  2. 键入Install Packages以打开包管理器。
  3. 键入美化到搜索框中。
  4. 选择atom-beautify或其他软件包之一,然后单击Install
  5. 现在您可以使用 atom-beautify CTRL+ ALT+的默认键绑定B来美化您的 HTML(在 Mac 上为CTRL+ OPTION+ B)。

回答by Lee

There are a few packages for prettifying HTML. You can find them by searching the Atom package archive:

有一些用于美化 HTML 的包。您可以通过搜索 Atom 包存档找到它们:

  1. Navigate to the Atom site
  2. Click the Packages link
  3. Enter "prettify" in the search box
  1. 导航到Atom 站点
  2. 单击包链接
  3. 在搜索框中输入“美化”

Or just go to this link: https://atom.io/packages/search?q=prettify

或者直接访问这个链接:https: //atom.io/packages/search?q=prettify

Once you've selected a package that does what you want you can install it by using the command: apm install [package name]from the command line or install it using the interface in Preferences.

一旦你选择了一个你想要的包,你就可以使用以下命令安装它:apm install [package name]从命令行或使用首选项中的界面安装它。

When the package is installed, follow its instructions for how to activate its capabilities.

安装软件包后,请按照其说明激活其功能。

回答by pungggi

https://github.com/Glavin001/atom-beautify

https://github.com/Glavin001/atom-beautify

Includes many different languages, html too..

包括许多不同的语言,html 也是..

回答by Jayantha

You can add atom beauty package for formatting text in atom..

您可以添加 atom 美化包用于在 atom.. 中格式化文本。

file --> setting --> Install

文件 --> 设置 --> 安装

then you type atom-beautifyin search area.

然后在搜索区域输入atom-beautify

then click Package button.. select atom beuty and install it.

然后单击 Package 按钮.. 选择 atom beuty 并安装它。

next you can format your text using (Alt + ctrl + b) or right click and select beautify editor contents

接下来,您可以使用 (Alt + ctrl + b) 或右键单击并选择美化编辑器内容来格式化文本

回答by Ajay

  1. Go to "Packages" in atom editor.
  2. Then in "Packages" view choose "Settings View".
  3. Choose "Install Packages/Themes".
  4. Search for "Atom Beautify" and install it.
  1. 转到原子编辑器中的“包”。
  2. 然后在“包”视图中选择“设置视图”。
  3. 选择“安装包/主题”。
  4. 搜索“Atom Beautify”并安装它。