This commit is contained in:
SunnyQjm committed 2020-08-18 20:45:59 +08:00
1 parent c34f112c28
commit 4d4724a328
18 files changed
+373

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
![logo](images/logo.png ':size=200')
# 咕咕笔记 <small>0.1.0</small>
> 这里是小咕可可爱爱的笔记们~
[GetStarted](README.md)
+3
View File
@@ -0,0 +1,3 @@
* [首页](/README.md)
* [NDN传输控制](/NDN传输控制/README.md)
* [概率论](/概率论/README.md)
+11
View File
@@ -0,0 +1,11 @@
- [README](/README.md)
- **概率论**
- [二项分布](/概率论/二项分布.md)
- [泊松分布与指数分布](/概率论/泊松分布与指数分布.md)
- [生灭过程](/概率论/生灭过程.md)
- [马尔可夫链与马尔可夫过程](/概率论/马尔可夫链与马尔可夫过程.md)
- **网络基础**
- [test](/网络基础/test.md)
Executable
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
action=$1
update(){
# 更新侧边栏
node ./scripts/generate-sidebar.js
# 更新全局搜索配置
node ./scripts/generate-docsify-config.js
echo 'docsifyConfig = `' > ./scripts/docsify-config-data.js
cat ./scripts/docsify.config.json >> ./scripts/docsify-config-data.js
echo '`' >> ./scripts/docsify-config-data.js
}
case $action in
update)
update
;;
deploy)
# 先更新
update
# 然后提交到git仓库
git add *
git commit -m 'update'
git push origin master
;;
esac
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+72
View File
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>咕咕笔记~</title>
<link rel="icon" href="images/logo.png"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="Description">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<style>
.app-name-link img {
width: 80px;
}
</style>
<body>
<div id="app"></div>
<script src="//unpkg.com/axios/dist/axios.min.js"></script>
<script src="scripts/docsify-config-data.js" type="text/javascript"></script>
<script src="scripts/docsify.config.js" type="text/javascript"></script>
<!--<script>-->
<!-- window.$docsify = {-->
<!-- name: 'gugu-note',-->
<!-- repo: 'https://github.com/SunnyQjm/quickandroid',-->
<!-- coverpage: true, // 启用封面-->
<!-- onlyCover: true, // 访问主页时只加载封面-->
<!-- autoHeader: true,-->
<!-- subMaxLevel: 4,-->
<!-- loadSidebar: true,-->
<!-- auto2top: true,-->
<!-- logo: '/images/logo.png',-->
<!-- // 完整配置参数-->
<!-- search: {-->
<!-- maxAge: -1, // 过期时间,单位毫秒,默认一天-->
<!-- // paths: 'auto',-->
<!-- paths: [-->
<!-- '/README.md',-->
<!-- '/概率论/生灭过程.md',-->
<!-- '/概率论/泊松分布与指数分布.md'-->
<!-- ], // or 'auto'-->
<!-- placeholder: '搜索',-->
<!-- noData: '找了个寂寞~',-->
<!-- // 搜索标题的最大层级, 1 - 6-->
<!-- depth: 6,-->
<!-- },-->
<!-- markdown: {-->
<!-- renderer: {-->
<!-- code: function (code, lang) {-->
<!-- if (lang === "mermaid") {-->
<!-- return (-->
<!-- '<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"-->
<!-- );-->
<!-- }-->
<!-- return this.origin.code.apply(this, arguments);-->
<!-- }-->
<!-- }-->
<!-- },-->
<!-- }-->
<!--</script>-->
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-c.js"></script>
<script src="//unpkg.com/prismjs/components/prism-cpp.js"></script>
<script src="//unpkg.com/prismjs/components/prism-java.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
<!-- CDN files for docsify-katex -->
<script src="//cdn.jsdelivr.net/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
</body>
</html>
+2
View File
@@ -0,0 +1,2 @@
docsifyConfig = `
{"name":"gugu-note","coverpage":true,"onlyCover":true,"autoHeader":true,"subMaxLevel":6,"loadSidebar":true,"auto2top":true,"logo":"/images/logo.png","search":{"maxAge":0,"paths":["/README.md","/概率论/二项分布.md","/概率论/泊松分布与指数分布.md","/概率论/生灭过程.md","/概率论/马尔可夫链与马尔可夫过程.md","/网络基础/test.md"],"placeholder":"搜索","noData":"找了个寂寞~","depth":6}}`
+45
View File
@@ -0,0 +1,45 @@
window.$docsify = {
name: 'gugu-note',
repo: 'https://github.com/SunnyQjm/quickandroid',
coverpage: true, // 启用封面
onlyCover: true, // 访问主页时只加载封面
autoHeader: true,
subMaxLevel: 4,
loadSidebar: true,
auto2top: true,
logo: '/images/logo.png',
// 完整配置参数
search: {
maxAge: 0, // 过期时间,单位毫秒,默认一天
paths: [
'/README.md',
'/概率论/生灭过程.md',
// '/概率论/泊松分布与指数分布.md'
], // or 'auto'
placeholder: 'Type to search',
noData: 'No Results!',
// 搜索标题的最大层级, 1 - 6
depth: 6,
},
markdown: {
renderer: {
code: function (code, lang) {
if (lang === "mermaid") {
return (
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
);
}
return this.origin.code.apply(this, arguments);
}
}
},
}
if (!!docsifyConfig) {
window.$docsify = {
...window.$docsify,
...JSON.parse(docsifyConfig)
};
}
console.log()
+1
View File
@@ -0,0 +1 @@
{"name":"gugu-note","coverpage":true,"onlyCover":true,"autoHeader":true,"subMaxLevel":6,"loadSidebar":true,"auto2top":true,"logo":"/images/logo.png","search":{"maxAge":0,"paths":["/README.md","/概率论/二项分布.md","/概率论/泊松分布与指数分布.md","/概率论/生灭过程.md","/概率论/马尔可夫链与马尔可夫过程.md","/网络基础/test.md"],"placeholder":"搜索","noData":"找了个寂寞~","depth":6}}
+96
View File
@@ -0,0 +1,96 @@
const path = require('path');
const fs = require('fs');
/**
* 扫描文件夹
*/
function scanFiles(dir, dirs = [], fileMap = {}, level = 0) {
const files = fs.readdirSync(dir);
if (dirs.length < level + 1) {
dirs.push([]);
}
files.forEach((item, index) => {
const fullPath = path.join(dir, item);
const stat = fs.statSync(fullPath);
if (!fileMap[dir]) {
fileMap[dir] = [];
}
fileMap[dir].push({
isDirectory: stat.isDirectory(),
file: fullPath
});
if (stat.isDirectory()) {
scanFiles(fullPath, dirs, fileMap, level + 1);
}
});
}
/**
* 自动生成侧边栏
* @param dir
* @param fileMap
* @param level
* @returns {string}
*/
function generateSideBar(dir, fileMap, level = 0, projectHomePath) {
let result = "";
if (!fileMap[dir])
return "";
let indent = '';
for (let i = 0; i < level; i++) {
indent += ' ';
}
fileMap[dir].forEach((item, index) => {
if ((item.isDirectory || path.extname(item.file) === '.md') && !item.file.startsWith(path.join(dir, '_'))) {
if (item.isDirectory) {
const tmp = generateSideBar(item.file, fileMap, level + 1, projectHomePath);
if (tmp) {
result += "\n\n";
result += indent;
result += `- **${path.relative(dir, item.file)}**`;
result += tmp;
}
} else {
result += "\n";
result += indent;
result += `- [${path.basename(item.file).replace(path.extname(item.file), '')}](${item.file.replace(projectHomePath, '')})`;
}
}
});
return result;
}
/**
* 生成全局搜索文件路径信息
* @param dir
* @param fileMap
* @param level
* @param projectHomePath
*/
function generateSearchPaths(dir, fileMap, level = 0, projectHomePath) {
let result = [];
fileMap[dir] && fileMap[dir].forEach((item, index) => {
if ((item.isDirectory || path.extname(item.file) === '.md') && !item.file.startsWith(path.join(dir, '_'))) {
if (item.isDirectory) {
result = result.concat(generateSearchPaths(item.file, fileMap, level + 1, projectHomePath));
} else {
result.push(item.file.replace(projectHomePath, ''))
}
}
});
return result;
}
const dirs = [];
const fileMap = {};
const projectHomePath = path.join(__dirname, '..'); // 项目主目录
// 扫描项目文件
scanFiles(projectHomePath, dirs, fileMap);
const config = JSON.parse(fs.readFileSync(path.join(__dirname, 'docsify.config.json')).toString());
config.search.paths = generateSearchPaths(projectHomePath, fileMap, 0, projectHomePath);
console.log(config);
fs.writeFileSync(path.join(__dirname, 'docsify.config.json'), JSON.stringify(config), 'utf8');
+75
View File
@@ -0,0 +1,75 @@
const path = require('path');
const fs = require('fs');
/**
* 扫描文件夹
*/
function scanFiles(dir, dirs = [], fileMap = {}, level = 0) {
const files = fs.readdirSync(dir);
if (dirs.length < level + 1) {
dirs.push([]);
}
files.forEach((item, index) => {
const fullPath = path.join(dir, item);
const stat = fs.statSync(fullPath);
if (!fileMap[dir]) {
fileMap[dir] = [];
}
fileMap[dir].push({
isDirectory: stat.isDirectory(),
file: fullPath
});
if (stat.isDirectory()) {
scanFiles(fullPath, dirs, fileMap, level + 1);
}
});
}
/**
* 自动生成侧边栏
* @param dir
* @param fileMap
* @param level
* @returns {string}
*/
function generateSideBar(dir, fileMap, level = 0, projectHomePath) {
let result = "";
if (!fileMap[dir])
return "";
let indent = '';
for (let i = 0; i < level; i++) {
indent += ' ';
}
fileMap[dir].forEach((item, index) => {
if ((item.isDirectory || path.extname(item.file) === '.md') && !item.file.startsWith(path.join(dir, '_'))) {
if (item.isDirectory) {
const tmp = generateSideBar(item.file, fileMap, level + 1, projectHomePath);
if (tmp) {
result += "\n\n";
result += indent;
result += `- **${path.relative(dir, item.file)}**`;
result += tmp;
}
} else {
result += "\n";
result += indent;
result += `- [${path.basename(item.file).replace(path.extname(item.file), '')}](${item.file.replace(projectHomePath, '')})`;
}
}
});
return result;
}
const dirs = [];
const fileMap = {};
const projectHomePath = path.join(__dirname, '..'); // 项目主目录
// 扫描项目文件
scanFiles(projectHomePath, dirs, fileMap);
// 从项目根目录开始处理
const slideBarMd = generateSideBar(projectHomePath, fileMap, 0, projectHomePath);
fs.writeFileSync(path.join(projectHomePath, '_sidebar.md'), slideBarMd, 'utf8');
// console.log(dirs);
// console.log(fileMap);
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
echo 'docsifyConfig = `' > docsify-config-data.js
cat docsify.config.json >> docsify-config-data.js
echo '`' >> docsify-config-data.js
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
# 更新侧边栏
node generate-sidebar.js
# 更新全局搜索配置
node generate-docsify-config.js
./generateDocsifyConfig.sh
+3
View File
@@ -0,0 +1,3 @@
# 二项分布
布噜布噜
+12
View File
@@ -0,0 +1,12 @@
啊舒服大时代撒个啊水电费
# 1 test
# 2 dsaff
# 3 5555
+6
View File
@@ -0,0 +1,6 @@
# 如果
生灭过程
# 有一天
Whitespace-only changes.
View File
Whitespace-only changes.