我使用highlight.js 来设计Java 样式,它为字符串、关键字和数字生成标记,但不为类型和文字生成标记。我使用的是highlight.js/9.11.0。
建议?
请参阅示例: https: //codepen.io/amandaw/pen/bWMraO
CSS
.hljs-variable {
color: red
}
.hljs-type {
color: orange
}
.hljs-literal {
color: yellow
}
Run Code Online (Sandbox Code Playgroud)
超文本标记语言
<pre><code class="java">
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Date d1 = new Date();
Calendar cl = Calendar. getInstance();
cl.setTime(d1);
System.out.println("today is "+ d1.toString());
cl. roll(Calendar.MONTH, 100);
System.out.println("date after a month will be " + cl.getTime().toString() );
cl. roll(Calendar.HOUR, 70);
System.out.println("date after 7 hrs will be "+ cl.getTime().toString() );
}
}
</code></pre>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1187 次 |
| 最近记录: |