注意:此文章默认您已安装package control。
1、JSHint (javascript语法检查器)
如图:检测出两个error
- 第9行第1列:‘bar‘ is not defined.
- 第7行第5列:‘fu‘ is defined but never used.
2、SublimeHighlight (自动高亮代码文本转换html文件,帮助快速构建自定义主题的代码片段)
该插件提供了多种theme。
autumn,
borland,
bw,
colorful,
default,
emacs,
friendly,
fruity,
manni,
monokai,
murphy,
native,
pastie,
perldoc,
rrt,
tango,
trac,
vim,
vs
实际效果如下:
自动生成部分,可通过setting - user中的noclasses控制是否使用行内样式。具体看github
<div class="highlight" style="background: #111111"><pre style="line-height: 125%"><span style="color: #fb660a; font-weight: bold">var</span> <span style="color: #ffffff">str</span> <span style="color: #ffffff">=</span> <span style="color: #0086d2">"hello word"</span><span style="color: #ffffff">;</span> <span style="color: #fb660a; font-weight: bold">var</span> <span style="color: #ffffff">number</span> <span style="color: #ffffff">=</span> <span style="color: #0086f7; font-weight: bold">100</span><span style="color: #ffffff">;</span> <span style="color: #008800; font-style: italic; background-color: #0f140f">/**</span> <span style="color: #008800; font-style: italic; background-color: #0f140f"> * [Demo description]</span> <span style="color: #008800; font-style: italic; background-color: #0f140f"> * @param {[string]} pStr [测试用]</span> <span style="color: #008800; font-style: italic; background-color: #0f140f"> * @param {[number]} pNumber [测试用]</span> <span style="color: #008800; font-style: italic; background-color: #0f140f"> */</span> <span style="color: #fb660a; font-weight: bold">function</span> <span style="color: #ffffff">Demo(pStr,pNumber){</span> <span style="color: #ffffff">console.log(pStr,pNumber);</span> <span style="color: #ffffff">}</span> <span style="color: #ffffff">Demo(str,number);</span> </pre></div>
var str = "hello word"; var number = 100; /** * [Demo description] * @param {[string]} pStr [测试用] * @param {[number]} pNumber [测试用] */ function Demo(pStr,pNumber){ console.log(pStr,pNumber); } Demo(str,number);
时间: 2024-09-30 13:03:34