日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網營銷解決方案
sublime如何格式化html

Sublime Text是一款非常流行的文本編輯器,它支持多種編程語言和文件格式,在Web開發(fā)中,HTML、CSS和JavaScript是最常用的技術,為了提高代碼的可讀性和一致性,我們需要對代碼進行格式化,本文將詳細介紹如何在Sublime Text中格式化HTML代碼。

1、安裝插件

我們需要安裝一個名為“HTMLCSSJS Prettify”的插件,這個插件可以幫助我們自動格式化HTML、CSS和JavaScript代碼,打開Sublime Text,點擊菜單欄的“Preferences”(首選項),然后選擇“Package Control”(包控制)。

2、安裝插件

在“Package Control”面板中,找到并點擊“Install Package”(安裝包)按鈕,在搜索框中輸入“HTMLCSSJS Prettify”,找到對應的插件并點擊安裝,等待插件安裝完成后,重啟Sublime Text。

3、配置插件

為了使用這個插件,我們需要對其進行一些配置,點擊菜單欄的“Preferences”(首選項),然后選擇“Settings”(設置),在設置文件中,添加以下內容:

{
    "html_format_options": {
        "indent_inner_html": true,
        "indent_scripts": "normal",
        "indent_headings": "normal",
        "indent_char": " ",
        "unformatted": ["a", "b", "i", "em", "strong", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "code"],
        "end_with_newline": false,
        "compact_empty_elements": false,
        "remove_trailing_commas": false,
        "remove_quotes": false,
        "keep_array_indentation": false,
        "break_chained_methods": false,
        "sort_attributes": false,
        "sort_default": true,
        "space_before_conditional": true,
        "unescape_strings": false,
        "jsx_single_quote": false,
        "jsx_double_quote": false,
        "jsx_angle_brackets": false,
        "jsx_self_closing": false,
        "jsx_wrap_attributes": "force",
        "space_before_function_paren": {
            "name": "none",
            "arguments": "none",
            "arrow": "ignore",
            "other": "force"
        },
        "space_after_anonymous_function": {
            "name": "none",
            "arguments": "none",
            "arrow": "ignore",
            "other": "force"
        },
        "space_before_blocks": true,
        "space_before_functions": true,
        "space_before_return": true,
        "space_before_switch": true,
        "space_before_throw": true,
        "space_before_try": true,
        "braces": {
            "style": "all",
            "color": "#000000",
            "padding": 1,
            "spacing": 1,
            "smart": true,
            "expand": true,
            "collapse": true,
            "horizontal": false,
            "vertical": false,
            "around": false,
            "align": false,
            "autowrap": false,
            "mirror": false,
            "lint": false,
            "strict": false,
            "warnings": false,
            "jsx_braces": false,
            "arrows": false,
            "liveedit": false,
            "positioning": false,
            "background": false,
            "foreground": false,
            "gutters": false,
            "draw_borders": false,
            "minimap": false,
            "classic": false,
            "css": false,
            "html": false,
            "contextmenu": false,
            "matchbrackets": true,
            "mode": null,
            "theme": null,
            "folding": false,
            "lineups": true,
            "breakable": true,
            "interlaced": true,
            "strictures": [],
            "domains": [],
            "firstline": 0,
            "lastline": Infinity,
            "safeguard: all"]}
    }
}

4、格式化HTML代碼

現在,我們可以使用快捷鍵Ctrl+Alt+J(Windows/Linux)或Cmd+Alt+J(Mac)來格式化HTML代碼了,如果你想要自定義快捷鍵,可以在設置文件中修改keybindings部分,將[{"keys":"ctrl+alt+j","command":"run_macro_file","args":"format html"},{"keys":"f9","command":"run_macro_file","args":"format html"},{"keys":"ctrl+shift+i","command":"toggle_comment"},{"keys":"ctrl+q","command":"exit"},{"keys":"ctrl+shift+/","command":"comment"},{"keys":"ctrl+shift+u","command":"uncomment"},{"keys":"ctrl+d","command":"delete_word"},{"keys":"ctrl+k","command":"kill_ring_save"},{"keys":"ctrl+t","command":"show_overlay"},{"keys":"ctrl+shift+n","command":"goto_definition"},{"keys":"ctrl+shift+f","command":"find"},{"keys":"ctrl+shift+r","command":"rename"},{"keys":"ctrl+shift+o","command":"show_overlay"},{"keys":"ctrl+shift+p","command":"goto_package"},{"keys":"ctrl+shift+m","command":"show_overlay"},{"keys":"ctrl+shift+/","command":"toggle_comment"},{"keys":"ctrl+shift+u","command":"uncomment"},{"keys":"ctrl+shift+c","command":"copy"},{"keys":"ctrl+shift+v","command":"paste"},{"keys":"ctrl+shift+x","command":"cut"},{"keys":"ctrl+shift+z","command":"undo"},{"keys":"ctrl+y","command":"redo"},{"keys":"ctrl+shift+l","command":"fold"},{"keys":"ctrl+shift+"}]"中的format html替換為你想要的快捷鍵。


文章標題:sublime如何格式化html
URL鏈接:http://www.5511xx.com/article/dhgpjip.html