Sublime Text 新建文件快速生成Html【頭部信息】和【代碼補(bǔ)全】、【漢化】

  • 安裝package control
    簡單的安裝方法:
    從菜單 View - Show Console 或者 ctrl + ~ 快捷鍵,調(diào)出 console。將以下 Python 代碼粘貼進(jìn)去并 enter 執(zhí)行,不出意外即完成安裝。以下提供 ST3 和 ST2 的安裝代碼:

Sublime Text 3:

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

Sublime Text 2:

import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

更多請參考
插件大全1例如:ColorPicker
插件大全2

  • 安裝漢化包

ctrl+`,復(fù)制命令或者直接復(fù)制下面:
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

1.點擊Preferences/Package Control,然后點擊Package Control:Install Package,(第一次運(yùn)行可以要幾秒鐘,因為要下載Package Control里面存在的包"花名冊"),然后在彈出的命令界面,輸入Chinese,選擇ChineseLocalization(回車或者鼠標(biāo)單擊擊)。
2.切換語言,幫助(H)/Language/簡體中文,繁體中文,日本語,English。

  • 安裝FileHeader插件

自動創(chuàng)建文件開頭模板,并且會根據(jù)最后的保存時間修改更新時間

  • 安裝CSS Format插件

css格式化

  • 安裝emmet插件

1、command + shift + p調(diào)出命令窗口,輸入install,選中package control:install package,等待
2、command + shift + p調(diào)出命令窗口,輸入emmet
3、【如果】刪除已安裝插件:按ctr+shift +p然后輸入remove 回車,再輸入要刪除的插件名。

開始使用:輸入以下簡寫,按tab鍵

html:5

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

注意:
編寫中文網(wǎng)頁,記得把頭部語言改為 <html lang="zh-cn"> 而不是<html lang="en">

html:xt【過渡型,PC端適應(yīng)老式瀏覽器】tips:DW生成的過渡類型文件沒有:xml:lang="en"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

html:4t

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

html:4s

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

html:xxs

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

ul#nav>li.itemS*4>a{Item $}

<ul id="nav">
    <li class="itemS"><a href="">Item 1</a></li>
    <li class="itemS"><a href="">Item 2</a></li>
    <li class="itemS"><a href="">Item 3</a></li>
    <li class="itemS"><a href="">Item 4</a></li>
</ul>

官方語法文檔

點擊這里

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容