为code
的代码显示添加行号,并高亮显示激活行。
在index.html
中的<head>
标签中添加:
<link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/spite-triangle/docsify-codeLineNum@latest/css/codeLineNum.css" />
在index.html
中的<body>
标签中添加:
<script src="https://cdn.jsdelivr.net/gh/spite-triangle/docsify-codeLineNum@latest/script/codeLineNum.min.js"></script>
在index.html1
中,在window.$docsify
设置代码块的黑名单,在该黑名单中的代码块,不会显示行号。
window.$docsify = {
codeLineNum: {
blacklist: ['python','java']
}
}
在markdown
中写入代码块
```cpp
#include <stdio.h>
#include <iostream>
using namespace std;
void main(int argc, char *argv[]){
cout << "hello world" << endl;
}
```
triangle@LEARN:~$ test