/docsify-codeLineNum

实现在docsify中,代码块显示行号

Primary LanguageJavaScript

docsify-codeLineNum

作用

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