从GitHub下载highlightjs的源代码,下载地址:https://github.com/highlightjs/highlight.js
在文件highlight.js中进行源代码的修改:
(function(factory) {
//highlightjs源代码
return hljs;
});
/**
* 加入源代码行号
*/
(function(window, document){
//创建行号样式
function createLineNumbersStyle(){
var lineNumbersStyle=[
".{0} ul {",
"list-style: decimal;",
"margin: 0px 0px 0 40px !important;",
"padding: 0px;}",
".{0} ul li {",
"list-style: decimal;",
"border-left: 1px solid #ddd !important;",
"padding: 5px!important;",
"margin: 0 !important;",
"line-height: 14px;",
"word-break: break-all;",
"word-wrap: break-word;}"
];
var styleEl = document.createElement("styl