个人头像

柠檬酸

1月前来过

控制台
欢迎来到我的博客!
默认封面

00:00/

播放列表

highlight.js实现代码高亮

发布于2016-12-02 / 729次浏览

自带本人超爱的monokai主题,虽然也自带了monokai-sublime,

但是和sublime-text 3 的monokai还是差了一点。不过总体效果不错!

 

演示地址:

http://cherryml.com/highlight/demo.html

 

截图演示:

 

11

 

 

 

How to use highlight.js

Getting Started

The bare minimum for using highlight.js on a web page is linking to the library along with one of the styles and callinginitHighlightingOnLoad:

<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

This will find and highlight code inside of <pre><code> tags; it tries to detect the language automatically. If automatic detection doesn’t work for you, you can specify the language in the class attribute:

<pre><code class="html">...</code></pre>

The list of supported language classes is available in the class reference. Classes can also be prefixed with either language-or lang-.

To disable highlighting altogether use the nohighlight class:

<pre><code class="nohighlight">...</code></pre>

最后修改于:2017年1月16日 下午8:29

喜欢 1
TAGS:  暂无标签
本站文章除注明转载/出处外,均为本站原创或翻译。若要转载但请务必注明出处,尊重他人劳动成果。 转载请注明出处链接 : highlight.js实现代码高亮

暂无评论