mirror of
https://github.com/jaywcjlove/linux-command.git
synced 2026-01-15 05:25:24 +00:00
add file .
This commit is contained in:
293
build/compile.js
Normal file
293
build/compile.js
Normal file
@@ -0,0 +1,293 @@
|
||||
var exec = require('child_process').exec;
|
||||
var fs = require('fs');
|
||||
var ejs = require('ejs');
|
||||
var path = require('path');
|
||||
var marked = require('marked');
|
||||
var watch = require('watch');
|
||||
var stylus = require('stylus')
|
||||
var highlight = require('highlight.js')
|
||||
var renderer = new marked.Renderer();
|
||||
var color = require('colors-cli/safe');
|
||||
var error = color.red.bold;
|
||||
var warn = color.yellow;
|
||||
var notice = color.blue;
|
||||
var success = color.green;
|
||||
|
||||
// console.log("该行代码所在的目录::",__dirname);
|
||||
// console.log("当前运行的的根目录::",path.dirname(__dirname));
|
||||
// console.log("当前目录名字::",path.basename(process.cwd()));
|
||||
// console.log("当前目录::",process.cwd());
|
||||
|
||||
renderer.heading = function (text, level) {
|
||||
if(/[\u4E00-\u9FA5]/i.test(text)){
|
||||
return '<h' + level + ' id="'+text.toLowerCase()+'">'+text+'</h' + level + '>';
|
||||
}else{
|
||||
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
return '<h' + level + ' id="'+escapedText+'">'+text+'</h' + level + '>';
|
||||
}
|
||||
}
|
||||
|
||||
marked.setOptions({
|
||||
renderer: renderer,
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: true,
|
||||
pedantic: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false,
|
||||
highlight: function (code, lang, callback) {
|
||||
if(lang){
|
||||
return callback('',highlight.highlight(lang,code).value);
|
||||
}else{
|
||||
return callback('',highlight.highlightAuto(code).value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var path_root = path.dirname(__dirname);
|
||||
|
||||
|
||||
// .deploy
|
||||
// 当前项目根目录
|
||||
// 生成 项目所需的文件
|
||||
CreateDatajs('./.deploy/js/dt.js',function(dt_path,arr){
|
||||
|
||||
cp(path.join(path_root,'/template/js/index.js'),
|
||||
path.join(path_root,'/.deploy/js/index.js'),function(err,r){
|
||||
if(err) return console.log(error(" → error:"),err.errno);
|
||||
console.log(success(" → ") + '/template/js/index.js');
|
||||
})
|
||||
|
||||
CreateStyl('/template/styl/index.styl','/.deploy/css/index.css')
|
||||
// 首页生成
|
||||
ReadTmpToHTML('/template/index.ejs','/.deploy/index.html');
|
||||
ReadTmpToHTML('/template/list.ejs','/.deploy/list.html');
|
||||
// 文章批量生成
|
||||
arr.forEach(function(itm,idx){
|
||||
var ejstpm = path.join('/template/',itm.p);
|
||||
var md_path = path.join('/command',itm.p);
|
||||
var dep = path.join('/.deploy/command',itm.p);
|
||||
ReadTmpToHTML('/template/details.ejs',dep+'.html',md_path+'.md')
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// 监听实时编译
|
||||
watch.watchTree(path.join(path.dirname(__dirname),'/'), function (f, curr, prev) {
|
||||
if (typeof f == "object" && prev === null && curr === null) {
|
||||
console.log(success(" → :watching ") + '/template/');
|
||||
// Finished walking the tree
|
||||
} else if (prev === null) {
|
||||
|
||||
// f is a new file
|
||||
} else if (curr.nlink === 0) {
|
||||
// f was removed
|
||||
} else {
|
||||
|
||||
if(/\.styl$/.test(f)){
|
||||
CreateStyl('/template/styl/index.styl','/.deploy/css/index.css')
|
||||
}else if(/\.js$/.test(f)){
|
||||
|
||||
cp(path.join(path_root,'/template/js/index.js'),
|
||||
path.join(path_root,'/.deploy/js/index.js'),function(err,r){
|
||||
if(err) return console.log(error(" → error:"),err.errno);
|
||||
console.log(success(" → ") + '/template/js/index.js');
|
||||
})
|
||||
|
||||
}else if(/\.ejs$/.test(f)){
|
||||
// 首页生成
|
||||
ReadTmpToHTML('/template/index.ejs','/.deploy/index.html');
|
||||
ReadTmpToHTML('/template/list.ejs','/.deploy/list.html');
|
||||
|
||||
}else if(/\.md$/.test(f)){
|
||||
var mdp = f.replace(path_root,'');
|
||||
var dep = path.join('/.deploy/',mdp);
|
||||
ReadTmpToHTML('/template/details.ejs',dep.replace('.md','.html'),mdp);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* [ReadTmpToHTML ejs 模板转换成HTML]
|
||||
* @param {[type]} from_path [模版来源地址]
|
||||
* @param {[type]} to_path [生成到指定的位置]
|
||||
* @param {[type]} md_path [Markdown的位置]
|
||||
*/
|
||||
function ReadTmpToHTML(from_path,to_path,md_path){
|
||||
var tmp_path = path.join(path.dirname(__dirname),from_path);
|
||||
if(!exists(tmp_path)) return console.log("\n → error: 模板文件 "+tmp_path+" 不存在")
|
||||
var tmp_str = fs.readFileSync(tmp_path);
|
||||
tmp_str = tmp_str.toString();
|
||||
|
||||
var relative_path = '';
|
||||
if(md_path){
|
||||
relative_path = path.relative(md_path.toString(),'/');
|
||||
relative_path = relative_path.replace(/\.\.$/,'');
|
||||
}
|
||||
// 生成 HTML
|
||||
var html = ejs.render(tmp_str,{
|
||||
filename: tmp_path,
|
||||
relative_path:relative_path
|
||||
});
|
||||
// 生成到指定目录
|
||||
var new_to_path = path.join(path.dirname(__dirname),to_path);
|
||||
// 循环创建目录
|
||||
mkdirsSync(path.dirname(new_to_path));
|
||||
if(md_path){
|
||||
var new_md_path = path.join(path.dirname(__dirname),md_path);
|
||||
var README_str = fs.readFileSync(new_md_path);
|
||||
marked(README_str.toString(),function(err,md_html){
|
||||
if (err) return console.log(error(' → '+md_path+" 转换成HTML失败!"));
|
||||
|
||||
html = html.replace('{{content}}',md_html);
|
||||
html = html.replace('<!--[编辑]-->','<a class="edit_btn" href="'+path.join('https://github.com/jaywcjlove/linux-command/edit/master/',md_path)+'">编辑</a>')
|
||||
fs.writeFileSync(new_to_path,html);
|
||||
console.log(success(" → ")+to_path + '');
|
||||
|
||||
})
|
||||
}else{
|
||||
|
||||
html = html.toString();
|
||||
fs.writeFileSync(new_to_path, html.replace(/\n/g,''));
|
||||
console.log(success(" → ")+to_path + '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* [CreateStyl 生成CSS]
|
||||
* @param {[type]} styl_path [description]
|
||||
* @param {[type]} css_path [description]
|
||||
*/
|
||||
function CreateStyl(styl_path,css_path){
|
||||
var new_css_path = path.join(path.dirname(__dirname),css_path);
|
||||
styl_path = path.dirname(__dirname) + styl_path;
|
||||
// var paths = [
|
||||
// path.dirname(__dirname) , path.dirname(__dirname) + '/'
|
||||
// ];
|
||||
var styl_str = fs.readFileSync(styl_path, 'utf8');
|
||||
stylus(styl_str.toString())
|
||||
.set('filename', styl_path )
|
||||
.set('compress', true)
|
||||
.render(function(err, css){
|
||||
if (err) throw err;
|
||||
// 循环创建目录
|
||||
mkdirsSync(path.dirname(new_css_path));
|
||||
fs.writeFileSync(new_css_path, css);
|
||||
// console.log(err,css);
|
||||
console.log(success(" → ")+styl_path + '');
|
||||
});
|
||||
}
|
||||
|
||||
// 生成数据索引JS
|
||||
function CreateDatajs(dt_path,callback){
|
||||
// 获取 markdown文件所在的目录
|
||||
var path_md = path.join(path.dirname(__dirname),'command');
|
||||
if(!exists(path_md)) return console.log("\n → error: 文件夹 "+path_md+" 不存在 \n ")
|
||||
// 获取 markdown 目录的集合
|
||||
var path_arr = readMDSync(path_md);
|
||||
var indexes = []
|
||||
path_arr.forEach(function(md_path,i){
|
||||
var json = {}
|
||||
var con = fs.readFileSync(md_path);
|
||||
var str = con.toString();
|
||||
var title = str.match(/[^===]+(?=[===])/g);
|
||||
// 命令名称
|
||||
json["n"] = title[0]?title[0].replace(/\n/g,''):title[0];
|
||||
// 命令路径
|
||||
json["p"] = md_path.replace(/\.md$/,'').replace(path_md,'');
|
||||
// 命令描述
|
||||
var des = str.match(/\n==={1,}([\s\S]*?)##/i);
|
||||
json["d"] = des[1]?des[1].replace(/\n/g,''):des[1];
|
||||
indexes.push(json)
|
||||
})
|
||||
mkdirsSync(path.dirname(dt_path));
|
||||
//生成数据文件
|
||||
fs.writeFile(dt_path, 'var linux_commands='+JSON.stringify(indexes) , 'utf8',function(err){
|
||||
console.log(success("\n → ")+"生成数据成功!"+dt_path+" \n ");
|
||||
callback&&callback(dt_path,indexes);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 同步循环创建所有目录 resolvePath
|
||||
function mkdirsSync(dirpath, mode, callback) {
|
||||
if(fs.existsSync(dirpath)){
|
||||
callback&&callback(dirpath);
|
||||
return true;
|
||||
}else{
|
||||
if(mkdirsSync(path.dirname(dirpath), mode)){
|
||||
fs.mkdirSync(dirpath, mode, callback);
|
||||
callback&&callback(dirpath);
|
||||
return true;
|
||||
}else{
|
||||
callback&&callback(dirpath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var fixture = path.join.bind(path, __dirname, 'template');
|
||||
|
||||
function cp(src, dest, cb) {
|
||||
// yield support
|
||||
if ('function' != typeof cb) return thunk;
|
||||
|
||||
var complete = false;
|
||||
var read = fs.createReadStream(src);
|
||||
var write = fs.createWriteStream(dest);
|
||||
|
||||
write.on('error', done);
|
||||
write.on('close', done);
|
||||
read.on('error', done);
|
||||
read.pipe(write);
|
||||
|
||||
// done callback
|
||||
function done(err) {
|
||||
if (!complete) {
|
||||
complete = true;
|
||||
read.destroy();
|
||||
write.destroy();
|
||||
cb(err);
|
||||
}
|
||||
}
|
||||
|
||||
// thunk-ified
|
||||
function thunk(done) {
|
||||
cp(src, dest, done);
|
||||
}
|
||||
}
|
||||
|
||||
//返回 MD 所有路径的 Array
|
||||
function readMDSync(filepath){
|
||||
if(!exists(filepath)) return [];
|
||||
var str = '',files = fs.readdirSync(filepath);
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var path_c = path.join(filepath,files[i]);
|
||||
if( isDir(path_c) ) {
|
||||
str += readMDSync(path_c) + ',';
|
||||
}
|
||||
else if(/\.(md)$/.test(files[i])) str += path_c + ',';
|
||||
};
|
||||
str = str.replace(/^\*|\,*$/g,'');
|
||||
return str.split(',');
|
||||
}
|
||||
//写文件
|
||||
function writeSync(filepath, content, callback) {
|
||||
mkdirsSync(path.dirname(filepath));
|
||||
return fs.writeFileSync(filepath, content, callback);
|
||||
};
|
||||
|
||||
//写文件
|
||||
function write(filepath, content) {
|
||||
return fs.writeFile(filepath, content);
|
||||
};
|
||||
|
||||
//判断是不是目录
|
||||
function isDir(_path){return exists(_path) && fs.statSync(_path).isDirectory();}
|
||||
|
||||
//检查指定路径的文件或者目录,是否存在
|
||||
function exists(_path){return fs.existsSync(_path);}
|
||||
124
command/find.md
Normal file
124
command/find.md
Normal file
@@ -0,0 +1,124 @@
|
||||
|
||||
find
|
||||
===
|
||||
|
||||
指定目录下查找文件。
|
||||
|
||||
## 补充说明
|
||||
|
||||
find命令用来在指定目录下查找文件。任何位于参数之前的字符串都将被视为欲查找的目录名。如果使用该命令时,不设置任何参数,则find命令将在当前目录下查找子目录与文件。并且将查找到的子目录和文件全部进行显示。
|
||||
|
||||
find指令用于查找符合条件的文件。任何位于参数之前的字符串都将被视为欲查找的目录。
|
||||
|
||||
## 语法
|
||||
|
||||
```bash
|
||||
find [目录...][-amin <分钟>][-anewer <参考文件或目录>][-atime <24小时数>][-cmin <分钟>][-cnewer <参考文件或目录>][-ctime <24小时数>][-daystart][-depyh][-empty][-exec <执行指令>][-false][-fls <列表文件>][-follow][-fprint <列表文件>][-fprint0 <列表文件>][-fprintf <列表文件><输出格式>][-fstype <文件系统类型>][-gid <群组识别码>][-group <群组名称>][-help][-ilname <范本样式>][-iname <范本样式>][-inum <inode编号>][-ipath <范本样式>][-iregex <范本样式>][-links <连接数目>][-lname <范本样式>][-ls][-maxdepth <目录层级>][-mindepth <目录层级>][-mmin <分钟>][-mount]
|
||||
[-mtime <24小时数>][-name <范本样式>][-newer <参考文件或目录>][-nogroup][noleaf] [-nouser][-ok <执行指令>][-path <范本样式>][-perm <权限数值>][-print][-print0][-printf <输出格式>][-prune][-regex <范本样式>][-size <文件大小>][-true][-type <文件类型>][-uid <用户识别码>][-used <日数>][-user <拥有者名称>][-version][-xdev][-xtype <文件类型>]
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
- -amin<分钟> 查找在指定时间曾被存取过的文件或目录,单位以分钟计算。
|
||||
- -anewer<参考文件或目录> 查找其存取时间较指定文件或目录的存取时间更接近现在的文件或目录。
|
||||
- -atime<24小时数> 查找在指定时间曾被存取过的文件或目录,单位以24小时计算。
|
||||
- -cmin<分钟> 查找在指定时间之时被更改的文件或目录。
|
||||
- -cnewer<参考文件或目录> 查找其更改时间较指定文件或目录的更改时间更接近现在的文件或目录。
|
||||
- -ctime<24小时数> 查找在指定时间之时被更改的文件或目录,单位以24小时计算。
|
||||
- -daystart 从本日开始计算时间。
|
||||
- -depth 从指定目录下最深层的子目录开始查找。
|
||||
- -expty 寻找文件大小为0 Byte的文件,或目录下没有任何子目录或文件的空目录。
|
||||
- -exec<执行指令> 假设find指令的回传值为True,就执行该指令。
|
||||
- -false 将find指令的回传值皆设为False。
|
||||
- -fls<列表文件> 此参数的效果和指定"-ls"参数类似,但会把结果保存为指定的列表文件。
|
||||
- -follow 排除符号连接。
|
||||
- -fprint<列表文件> 此参数的效果和指定"-print"参数类似,但会把结果保存成指定的列表文件。
|
||||
- -fprint0<列表文件> 此参数的效果和指定"-print0"参数类似,但会把结果保存成指定的列表文件。
|
||||
- -fprintf<列表文件><输出格式> 此参数的效果和指定"-printf"参数类似,但会把结果保存成指定的列表文件。
|
||||
- -fstype<文件系统类型> 只寻找该文件系统类型下的文件或目录。
|
||||
- -gid<群组识别码> 查找符合指定之群组识别码的文件或目录。
|
||||
- -group<群组名称> 查找符合指定之群组名称的文件或目录。
|
||||
- -help或--help 在线帮助。
|
||||
- -ilname<范本样式> 此参数的效果和指定"-lname"参数类似,但忽略字符大小写的差别。
|
||||
- -iname<范本样式> 此参数的效果和指定"-name"参数类似,但忽略字符大小写的差别。
|
||||
- -inum<inode编号> 查找符合指定的inode编号的文件或目录。
|
||||
- -ipath<范本样式> 此参数的效果和指定"-ipath"参数类似,但忽略字符大小写的差别。
|
||||
- -iregex<范本样式> 此参数的效果和指定"-regexe"参数类似,但忽略字符大小写的差别。
|
||||
- -links<连接数目> 查找符合指定的硬连接数目的文件或目录。
|
||||
- -iname<范本样式> 指定字符串作为寻找符号连接的范本样式。
|
||||
- -ls 假设find指令的回传值为True,就将文件或目录名称列出到标准输出。
|
||||
- -maxdepth<目录层级> 设置最大目录层级。
|
||||
- -mindepth<目录层级> 设置最小目录层级。
|
||||
- -mmin<分钟> 查找在指定时间曾被更改过的文件或目录,单位以分钟计算。
|
||||
- -mount 此参数的效果和指定"-xdev"相同。
|
||||
- -mtime<24小时数> 查找在指定时间曾被更改过的文件或目录,单位以24小时计算。
|
||||
- -name<范本样式> 指定字符串作为寻找文件或目录的范本样式。
|
||||
- -newer<参考文件或目录> 查找其更改时间较指定文件或目录的更改时间更接近现在的文件或目录。
|
||||
- -nogroup 找出不属于本地主机群组识别码的文件或目录。
|
||||
- -noleaf 不去考虑目录至少需拥有两个硬连接存在。
|
||||
- -nouser 找出不属于本地主机用户识别码的文件或目录。
|
||||
- -ok<执行指令> 此参数的效果和指定"-exec"参数类似,但在执行指令之前会先询问用户,若回答"y"或"Y",则放弃执行指令。
|
||||
- -path<范本样式> 指定字符串作为寻找目录的范本样式。
|
||||
- -perm<权限数值> 查找符合指定的权限数值的文件或目录。
|
||||
- -print 假设find指令的回传值为True,就将文件或目录名称列出到标准输出。格式为每列一个名称,每个名称之前皆有"./"字符串。
|
||||
- -print0 假设find指令的回传值为True,就将文件或目录名称列出到标准输出。格式为全部的名称皆在同一行。
|
||||
- -printf<输出格式> 假设find指令的回传值为True,就将文件或目录名称列出到标准输出。格式可以自行指定。
|
||||
- -prune 不寻找字符串作为寻找文件或目录的范本样式。
|
||||
- -regex<范本样式> 指定字符串作为寻找文件或目录的范本样式。
|
||||
- -size<文件大小> 查找符合指定的文件大小的文件。
|
||||
- -true 将find指令的回传值皆设为True。
|
||||
- -typ<文件类型> 只寻找符合指定的文件类型的文件。
|
||||
- -uid<用户识别码> 查找符合指定的用户识别码的文件或目录。
|
||||
- -used<日数> 查找文件或目录被更改之后在指定时间曾被存取过的文件或目录,单位以日计算。
|
||||
- -user<拥有者名称> 查找符合指定的拥有者名称的文件或目录。
|
||||
- -version或--version 显示版本信息。
|
||||
- -xdev 将范围局限在先行的文件系统中。
|
||||
- -xtype<文件类型> 此参数的效果和指定"-type"参数类似,差别在于它针对符号连接检查。
|
||||
|
||||
## 例子
|
||||
|
||||
```bash
|
||||
$ find . -name '*.DS_Store' -type f -delete # 删除所有.DS_Store文件
|
||||
$ find ~ -name "*.txt" -print # 在$HOME中查.txt文件并显示
|
||||
$ find . -size +1000000c -print # 查长度大于1Mb的文件
|
||||
$ find . -size 100c -print # 查长度为100c的文件
|
||||
$ find . -size +10 -print # 查长度超过期作废10块的文件(1块=512字节)
|
||||
$ find -name april* # 在当前目录下查找以april开始的文件
|
||||
$ find -name april* fprint file # 在当前目录下查找以april开始的文件,并把结果输出到file中
|
||||
$ find -name ap* -o -name may* # 查找以ap或may开头的文件
|
||||
$ find /mnt -name tom.txt -ftype vfat # 在/mnt下查找名称为tom.txt且文件系统类型为vfat的文件
|
||||
$ find /mnt -name t.txt ! -ftype vfat # 在/mnt下查找名称为tom.txt且文件系统类型不为vfat的文件
|
||||
$ find /tmp -name wa* -type l # 在/tmp下查找名为wa开头且类型为符号链接的文件
|
||||
$ find ~ -mtime -2 # 在/home下查最近两天内改动过的文件
|
||||
$ find ~ -atime -1 # 查1天之内被存取过的文件
|
||||
$ find ~ -mmin +60 # 在/home下查60分钟前改动过的文件
|
||||
$ find ~ -amin +30 # 查最近30分钟前被存取过的文件
|
||||
$ find ~ -newer tmp.txt # 在/home下查更新时间比tmp.txt近的文件或目录
|
||||
$ find ~ -anewer tmp.txt # 在/home下查存取时间比tmp.txt近的文件或目录
|
||||
$ find ~ -used -2 # 列出文件或目录被改动过之后,在2日内被存取过的文件或目录
|
||||
$ find ~ -user cnscn # 列出/home目录内属于用户cnscn的文件或目录
|
||||
$ find ~ -uid +501 # 列出/home目录内用户的识别码大于501的文件或目录
|
||||
$ find ~ -group cnscn # 列出/home内组为cnscn的文件或目录
|
||||
$ find ~ -gid 501 # 列出/home内组id为501的文件或目录
|
||||
$ find ~ -nouser # 列出/home内不属于本地用户的文件或目录
|
||||
$ find ~ -nogroup # 列出/home内不属于本地组的文件或目录
|
||||
$ find ~ -name tmp.txt -maxdepth 4 # 列出/home内的tmp.txt 查时深度最多为3层
|
||||
$ find ~ -name tmp.txt -mindepth 3 # 从第2层开始查
|
||||
$ find ~ -empty # 查找大小为0的文件或空目录
|
||||
$ find ~ -size +512k # 查大于512k的文件
|
||||
$ find ~ -size -512k # 查小于512k的文件
|
||||
$ find ~ -links +2 # 查硬连接数大于2的文件或目录
|
||||
$ find ~ -perm 0700 # 查权限为700的文件或目录
|
||||
$ find ~ -perm 755 -print | more # 查找权限为755的文件
|
||||
$ find /tmp -name tmp.txt -exec cat {} \;
|
||||
$ find /tmp -name tmp.txt ok rm {} \;
|
||||
|
||||
$ find / -amin -10 # 查找在系统中最后10分钟访问的文件
|
||||
$ find / -atime -2 # 查找在系统中最后48小时访问的文件
|
||||
$ find / -empty # 查找在系统中为空的文件或者文件夹
|
||||
$ find / -group cat # 查找在系统中属于 groupcat的文件
|
||||
$ find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件
|
||||
$ find / -mtime -1 # 查找在系统中最后24小时里修改过的文件
|
||||
$ find / -nouser # 查找在系统中属于作废用户的文件
|
||||
$ find / -user fred # 查找在系统中属于FRED这个用户的文件
|
||||
```
|
||||
34
command/fs/cat.md
Normal file
34
command/fs/cat.md
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
cat
|
||||
===
|
||||
|
||||
显示文件的内容。
|
||||
|
||||
## 补充说明
|
||||
|
||||
cat命令连接文件并打印到标准输出设备上,cat经常用来显示文件的内容,类似于下的type命令。
|
||||
|
||||
## 语法
|
||||
|
||||
```
|
||||
cat(选项)(参数)
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
- -n或-number:有1开始对所有输出的行数编号;
|
||||
- -b或--number-nonblank:和-n相似,只不过对于空白行不编号;
|
||||
- -s或--squeeze-blank:当遇到有连续两行以上的空白行,就代换为一行的空白行;
|
||||
- -A:显示不可打印字符,行尾显示“$”;
|
||||
- -e:等价于"-vE"选项;
|
||||
- -t:`等价`于"-vT"选项;
|
||||
|
||||
|
||||
## 例子
|
||||
|
||||
```bash
|
||||
cat m1 # (在屏幕上显示文件ml的内容)
|
||||
cat m1 m2 # (同时显示文件ml和m2的内容)
|
||||
cat m1 m2 > file # (将文件ml和m2合并后放入文件file中)
|
||||
```
|
||||
|
||||
38
command/mv.md
Normal file
38
command/mv.md
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
mv
|
||||
===
|
||||
|
||||
文件或目录重新命名和移动。
|
||||
|
||||
## 补充说明
|
||||
|
||||
mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。
|
||||
|
||||
mv命令可以用来将源文件移至一个目标文件中,或将一组文件移至一个目标目录中。源文件被移至目标文件有两种不同的结果:
|
||||
|
||||
- 如果目标文件是到某一目录文件的路径,源文件会被移到此目录下,且文件名不变。
|
||||
- 如果目标文件不是目录文件,则源文件名(只能有一个)会变为此目标文件名,并覆盖己存在的同名文件。如果源文件和目标文件在同一个目录下,mv的作用就是改文件名。当目标文件是目录文件时,源文件或目录参数可以有多个,则所有的源文件都会被移至目标文件中。所有移到该目录下的文件都将保留以前的文件名。
|
||||
|
||||
注意事项:mv与cp的结果不同,mv好像文件“搬家”,文件个数并未增加。而cp对文件进行复制,文件个数增加了。
|
||||
|
||||
## 语法
|
||||
|
||||
```bash
|
||||
mv(选项)(参数)
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
- --backup=<备份模式>:若需覆盖文件,则覆盖前先行备份;
|
||||
- -b:当文件存在时,覆盖前,为其创建一个备份;
|
||||
- -f:若目标文件或目录与现有的文件或目录重复,则直接覆盖现有的文件或目录;
|
||||
- -i:交互式操作,覆盖前先行询问用户,如果源文件与目标文件或目标目录中的文件同名,则询问用户是否覆盖目标文件。用户输入”y”,表示将覆盖目- 标文件;输入”n”,表示取消对源文件的移动。这样可以避免误将文件覆盖。 --strip-trailing-slashes:删除源文件中的斜杠“/”;
|
||||
- -S<后缀>:为备份文件指定后缀,而不使用默认的后缀;
|
||||
- --target-directory=<目录>:指定源文件要移动到目标目录;
|
||||
- -u:当源文件比目标文件新或者目标文件不存在时,才执行移动操作。
|
||||
|
||||
## 例子
|
||||
|
||||
```bash
|
||||
mv file3 new_command # 将文件 file3 改名为 new_command
|
||||
```
|
||||
33
package.json
Normal file
33
package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "linux-command",
|
||||
"version": "1.0.0",
|
||||
"description": "Linux Command",
|
||||
"main": "build/compile.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node build/compile.js",
|
||||
"build:css": "stylus -u autoprefixer-stylus template/styl/index.styl -o .deploy/ -c",
|
||||
"watch:css": "stylus -u autoprefixer-stylus -w template/styl/index.styl -o .deploy/ -c"
|
||||
},
|
||||
"keywords": [
|
||||
"Linux",
|
||||
"Command"
|
||||
],
|
||||
"author": "kenny wang <wowohoo@qq.com>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jaywcjlove/linux-command.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.5.1",
|
||||
"autoprefixer-stylus": "^0.11.0",
|
||||
"colors-cli": "^1.0.7",
|
||||
"ejs": "^2.5.2",
|
||||
"highlight.js": "^9.8.0",
|
||||
"marked": "^0.3.6",
|
||||
"ssr": "^1.1.1",
|
||||
"stylus": "^0.54.5",
|
||||
"watch": "^1.0.1"
|
||||
}
|
||||
}
|
||||
10
template/details.ejs
Normal file
10
template/details.ejs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
<%-include('header'); %>
|
||||
<%- include('search',{type: "list"}); %>
|
||||
|
||||
<div class="markdown-body">
|
||||
<!--[编辑]-->
|
||||
{{content}}
|
||||
</div>
|
||||
|
||||
<%- include('footer'); %>
|
||||
4
template/footer.ejs
Normal file
4
template/footer.ejs
Normal file
@@ -0,0 +1,4 @@
|
||||
<script type="text/javascript" src="<%=relative_path%>js/dt.js"></script>
|
||||
<script type="text/javascript" src="<%=relative_path%>js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
11
template/header.ejs
Normal file
11
template/header.ejs
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="description" content="最专业的Linux命令大全,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。">
|
||||
<meta name="keywords" content="Linux,Command">
|
||||
<title>Linux Command</title>
|
||||
<link rel="stylesheet" type="text/css" href="<%=relative_path%>css/index.css">
|
||||
</head>
|
||||
<body>
|
||||
15
template/img/logo.svg
Normal file
15
template/img/logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 17 KiB |
4
template/index.ejs
Normal file
4
template/index.ejs
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
<%- include('header'); %>
|
||||
<%- include('search',{type: "index"}); %>
|
||||
<%- include('footer'); %>
|
||||
119
template/js/index.js
Normal file
119
template/js/index.js
Normal file
@@ -0,0 +1,119 @@
|
||||
(function(){
|
||||
function Commands(){
|
||||
var $$ = this.$$;
|
||||
this.commands = linux_commands || [];
|
||||
this.elm_query = $$('query');
|
||||
this.elm_btn = $$('search_btn');
|
||||
this.elm_info = $$('commands_info');
|
||||
this.elm_result = $$('result');
|
||||
|
||||
this.query = ''; //
|
||||
this.page_size = 10; //每页显示10条
|
||||
|
||||
this.init()
|
||||
}
|
||||
|
||||
Commands.prototype = {
|
||||
$$:function(id){
|
||||
return document.getElementById(id)
|
||||
},
|
||||
bindEvent:function(elm,type,handle){
|
||||
if (elm.addEventListener) {
|
||||
elm.addEventListener(type, handle, false);
|
||||
} else if (elm.attachEvent) {
|
||||
elm.attachEvent('on'+type, handle);
|
||||
}
|
||||
},
|
||||
isSreachIndexOF:function(oldstr,kw){
|
||||
var istrue = false;
|
||||
if(oldstr&&toString.call(oldstr) === '[object Array]'){
|
||||
for (var i = 0; i < oldstr.length; i++) {
|
||||
oldstr[i].toLowerCase()===kw.toLowerCase()?istrue=true:null;
|
||||
}
|
||||
return istrue;
|
||||
}
|
||||
if(!oldstr || !kw) return false;
|
||||
return oldstr.toLowerCase().indexOf(kw.toLowerCase()) > -1 ? true : false;
|
||||
},
|
||||
//获取URL上面的参数
|
||||
getQueryString:function(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
console.log("reg1:",reg);
|
||||
var r = decodeURIComponent(window.location.hash.replace(/^(\#\!|\#)/,'')).match(reg);
|
||||
console.log("reg2:",r);
|
||||
if (r != null) return unescape(r[2]); return null;
|
||||
},
|
||||
pushState:function(){
|
||||
if(window.history&&window.history.pushState)
|
||||
this.query ? history.pushState({},"linux_commands","#!kw="+this.query):
|
||||
history.pushState({},"linux_commands","/");
|
||||
},
|
||||
//简单模版
|
||||
simple:function(str,obj){
|
||||
return str.replace(/\$\w+\$/gi, function(matchs) {
|
||||
var returns = obj[matchs.replace(/\$/g, "")];
|
||||
return typeof returns === "undefined" ? "" : returns;
|
||||
})
|
||||
},
|
||||
createKeyworldsHTML:function(json,keywolds){
|
||||
var name = json.n,des = json.d,self = this,
|
||||
reg = new RegExp("("+keywolds+")","ig");
|
||||
if(keywolds){
|
||||
name = json.n.replace(reg,'<i class="kw">'+"$1"+"</i>");
|
||||
des = json.d.replace(reg,'<i class="kw">'+"$1"+"</i>") || '';
|
||||
}
|
||||
|
||||
return this.simple('<a href="/command$url$.html"><strong>$name$</strong> - $des$</a>',{
|
||||
name:name,
|
||||
url:json.p,
|
||||
des:des
|
||||
})
|
||||
|
||||
},
|
||||
createListHTML:function(){
|
||||
var arr = this.commands,self = this,page_size = this.page_size,i=0;
|
||||
if(arr&&arr.length&&toString.call(arr).indexOf('Array')>-1){
|
||||
self.elm_result.innerHTML=''
|
||||
for (; i < page_size; i++) {
|
||||
if(!arr[i]) break;
|
||||
if(self.isSreachIndexOF(arr[i].n,self.query)
|
||||
|| self.isSreachIndexOF(arr[i].d,self.query)
|
||||
){
|
||||
var myLi = document.createElement("LI");
|
||||
myLi.innerHTML = self.createKeyworldsHTML(arr[i],self.query)
|
||||
self.elm_result.appendChild(myLi);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
init:function(){
|
||||
var self = this;
|
||||
var kw = self.getQueryString('kw');
|
||||
var timer = null
|
||||
this.elm_query.value = kw;
|
||||
this.query = kw;
|
||||
this.bindEvent(this.elm_query,'input',function(e){
|
||||
self.query = e.target.value;
|
||||
self.pushState()
|
||||
self.createListHTML();
|
||||
self.elm_result.style.display = self.query?'block':'none';
|
||||
})
|
||||
this.bindEvent(this.elm_btn,'click',function(e){
|
||||
self.createListHTML();
|
||||
})
|
||||
this.bindEvent(this.elm_query,'focus',function(e){
|
||||
self.createListHTML();
|
||||
self.elm_result.style.display = 'block';
|
||||
})
|
||||
this.bindEvent(this.elm_query,'blur',function(e){
|
||||
timer = setTimeout(function(){
|
||||
self.elm_result.style.display = 'none';
|
||||
},600)
|
||||
})
|
||||
if(kw) self.createListHTML();
|
||||
}
|
||||
}
|
||||
|
||||
new Commands()
|
||||
|
||||
})()
|
||||
74
template/list.ejs
Normal file
74
template/list.ejs
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
<%- include('header',{src:""}); %>
|
||||
<%- include('search',{type: "list"}); %>
|
||||
|
||||
<div class="search_list">
|
||||
<ul>
|
||||
<li>
|
||||
<a href=""><strong>find</strong> - 指定目录下查找文件。</a>
|
||||
<p>find命令用来在指定目录下查找文件。任何位于参数之前的字符串都将被视为欲查找的目录名。如果使用该命令时,不设置任何参数,则find命令将在当前目录下查找子目录与文件。并且将查找到的子目录和文件全部进行显示。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>mv</strong> - 文件或目录重新命名和移动。</a>
|
||||
<p>mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>pssh</strong> - 多台服务器上执行命令的工具。</a>
|
||||
<p>是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>cat</strong> - 用来显示文件的内容。</a>
|
||||
<p>连接文件并打印到标准输出设备上,cat经常用来显示文件的内容,类似于下的。注意:当文件较大时,文本在屏幕上迅速闪过(滚屏),用户往往看不清所显示的内容。因此,一般用</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>find</strong> - 指定目录下查找文件。</a>
|
||||
<p>find命令用来在指定目录下查找文件。任何位于参数之前的字符串都将被视为欲查找的目录名。如果使用该命令时,不设置任何参数,则find命令将在当前目录下查找子目录与文件。并且将查找到的子目录和文件全部进行显示。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>mv</strong> - 文件或目录重新命名和移动。</a>
|
||||
<p>mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>pssh</strong> - 多台服务器上执行命令的工具。</a>
|
||||
<p>是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>cat</strong> - 用来显示文件的内容。</a>
|
||||
<p>连接文件并打印到标准输出设备上,cat经常用来显示文件的内容,类似于下的。注意:当文件较大时,文本在屏幕上迅速闪过(滚屏),用户往往看不清所显示的内容。因此,一般用</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>find</strong> - 指定目录下查找文件。</a>
|
||||
<p>find命令用来在指定目录下查找文件。任何位于参数之前的字符串都将被视为欲查找的目录名。如果使用该命令时,不设置任何参数,则find命令将在当前目录下查找子目录与文件。并且将查找到的子目录和文件全部进行显示。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>mv</strong> - 文件或目录重新命名和移动。</a>
|
||||
<p>mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>pssh</strong> - 多台服务器上执行命令的工具。</a>
|
||||
<p>是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>cat</strong> - 用来显示文件的内容。</a>
|
||||
<p>连接文件并打印到标准输出设备上,cat经常用来显示文件的内容,类似于下的。注意:当文件较大时,文本在屏幕上迅速闪过(滚屏),用户往往看不清所显示的内容。因此,一般用</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>find</strong> - 指定目录下查找文件。</a>
|
||||
<p>find命令用来在指定目录下查找文件。任何位于参数之前的字符串都将被视为欲查找的目录名。如果使用该命令时,不设置任何参数,则find命令将在当前目录下查找子目录与文件。并且将查找到的子目录和文件全部进行显示。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>mv</strong> - 文件或目录重新命名和移动。</a>
|
||||
<p>mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>pssh</strong> - 多台服务器上执行命令的工具。</a>
|
||||
<p>是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问。</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href=""><strong>cat</strong> - 用来显示文件的内容。</a>
|
||||
<p>连接文件并打印到标准输出设备上,cat经常用来显示文件的内容,类似于下的。注意:当文件较大时,文本在屏幕上迅速闪过(滚屏),用户往往看不清所显示的内容。因此,一般用</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%- include('footer'); %>
|
||||
20
template/search.ejs
Normal file
20
template/search.ejs
Normal file
File diff suppressed because one or more lines are too long
215
template/styl/index.styl
Normal file
215
template/styl/index.styl
Normal file
@@ -0,0 +1,215 @@
|
||||
@import('mixins/reset.styl')
|
||||
@import('mixins/highlight.styl')
|
||||
@import('mixins/markdown.styl')
|
||||
|
||||
|
||||
a.github-corner {
|
||||
position: fixed
|
||||
top: 0
|
||||
right: 0
|
||||
&:hover{
|
||||
.octo-arm{
|
||||
animation:octocat-wave 560ms ease-in-out
|
||||
}
|
||||
}
|
||||
svg{
|
||||
fill #f1f1f1
|
||||
color #000
|
||||
position absolute
|
||||
top 0
|
||||
border 0
|
||||
right 0
|
||||
z-index 99
|
||||
width 70px
|
||||
height 70px
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes octocat-wave{
|
||||
0%,100%{-webkit-transform:rotate(0);transform:rotate(0)}
|
||||
20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}
|
||||
40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}
|
||||
}
|
||||
|
||||
|
||||
.header{
|
||||
width 517px
|
||||
margin 0 auto 0
|
||||
padding 0 10px
|
||||
.logo{
|
||||
text-align center
|
||||
padding-top 50px
|
||||
padding-bottom 50px
|
||||
}
|
||||
.box{
|
||||
position relative
|
||||
}
|
||||
.search{
|
||||
min-height 20px
|
||||
position relative
|
||||
display table
|
||||
border-collapse separate
|
||||
li,ul{
|
||||
list-style none
|
||||
}
|
||||
.search-list{
|
||||
position absolute
|
||||
display none
|
||||
z-index 999
|
||||
box-shadow 1px 1px 3px #ededed
|
||||
border 1px solid #d5d5d5
|
||||
background #fff
|
||||
min-width 100px
|
||||
top 39px
|
||||
width 100%
|
||||
padding 5px
|
||||
border-radius 5px 5px 5px 5px
|
||||
li{
|
||||
line-height 23px
|
||||
}
|
||||
a{
|
||||
display block
|
||||
padding 2px 6px 2px 6px
|
||||
color #555555
|
||||
&:hover{
|
||||
background-color #f2f2f2
|
||||
}
|
||||
.kw{
|
||||
color #f00
|
||||
font-style inherit
|
||||
font-weight bold
|
||||
}
|
||||
}
|
||||
}
|
||||
.query,.enter-input{
|
||||
display table-cell
|
||||
transition border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
|
||||
}
|
||||
.query{
|
||||
position relative
|
||||
z-index 2
|
||||
width 100%
|
||||
height 40px
|
||||
padding 6px 12px
|
||||
font-size 14px
|
||||
font-weight bold
|
||||
line-height 1.42857143
|
||||
color #555
|
||||
background-color #fff
|
||||
background-image none
|
||||
border 1px solid $border-color
|
||||
border-radius 5px 0 0 5px
|
||||
&:focus{
|
||||
z-index 99
|
||||
border-color #66afe9
|
||||
outline 0
|
||||
box-shadow inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)
|
||||
}
|
||||
}
|
||||
.enter-input{
|
||||
width 1%
|
||||
white-space nowrap
|
||||
vertical-align middle
|
||||
button{
|
||||
position relative
|
||||
z-index 5
|
||||
display inline-block
|
||||
padding 9px 23px
|
||||
margin-bottom 0
|
||||
margin-left -1px
|
||||
font-size 14px
|
||||
font-weight bold
|
||||
line-height 1.42857143
|
||||
text-align center
|
||||
text-rendering auto
|
||||
white-space nowrap
|
||||
vertical-align middle
|
||||
touch-action manipulation
|
||||
cursor pointer
|
||||
user-select none
|
||||
background-image none
|
||||
background-color #fff
|
||||
border 1px solid transparent
|
||||
border-collapse separate
|
||||
border-radius 0 5px 5px 0
|
||||
border-color $border-color
|
||||
color #333
|
||||
&:focus,&:active:focus{
|
||||
outline thin dotted
|
||||
outline 5px auto -webkit-focus-ring-color
|
||||
outline-offset -2px
|
||||
}
|
||||
&:active{
|
||||
color #333
|
||||
background-color #e6e6e6
|
||||
border-color #b4b4b4
|
||||
background-image none
|
||||
box-shadow inset 0 8px 32px -8px rgba(0,0,0,0.3)
|
||||
}
|
||||
&:focus{
|
||||
color #333
|
||||
background-color #e6e6e6
|
||||
border-color #999
|
||||
text-decoration none
|
||||
}
|
||||
&:hover{
|
||||
color #333
|
||||
background-color #e6e6e6
|
||||
border-color #b4b4b4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.footer{
|
||||
text-align center
|
||||
padding-top 31px
|
||||
color #616161
|
||||
font-size 14px
|
||||
font-weight 300
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.header.header_list{
|
||||
width auto
|
||||
}
|
||||
|
||||
.header_list{
|
||||
padding 10px 10px 10px 13px
|
||||
border-bottom 1px solid #EEEEEE
|
||||
.logo{
|
||||
float left
|
||||
padding-top 3px
|
||||
padding-bottom 0
|
||||
padding-right 24px
|
||||
text-align left
|
||||
svg{
|
||||
height 37px
|
||||
width 136px
|
||||
}
|
||||
}
|
||||
.search{
|
||||
max-width 517px
|
||||
}
|
||||
.footer{
|
||||
display none
|
||||
}
|
||||
}
|
||||
|
||||
.search_list{
|
||||
padding 17px 27px
|
||||
a{
|
||||
font-size 16px
|
||||
strong{
|
||||
font-weight bold
|
||||
}
|
||||
}
|
||||
li{
|
||||
padding 10px 0 10px 0
|
||||
p{
|
||||
padding-top 5px
|
||||
color #4F4F4F
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
50
template/styl/mixins/highlight.styl
Normal file
50
template/styl/mixins/highlight.styl
Normal file
@@ -0,0 +1,50 @@
|
||||
.hljs{
|
||||
display:block;overflow-x:auto;padding:0.5em;color:#333;background:#f8f8f8
|
||||
}
|
||||
.hljs-comment,.hljs-quote{
|
||||
color:#998;font-style:italic
|
||||
}
|
||||
.hljs-keyword,.hljs-selector-tag,.hljs-subst{
|
||||
color:#333;font-weight:bold
|
||||
}
|
||||
.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{
|
||||
color:#008080
|
||||
}
|
||||
.hljs-string,.hljs-doctag{
|
||||
color:#d14
|
||||
}
|
||||
.hljs-title,.hljs-section,.hljs-selector-id{
|
||||
color:#900;font-weight:bold
|
||||
}
|
||||
.hljs-subst{
|
||||
font-weight:normal
|
||||
}
|
||||
.hljs-type,.hljs-class .hljs-title{
|
||||
color:#458;font-weight:bold
|
||||
}
|
||||
.hljs-tag,.hljs-name,.hljs-attribute{
|
||||
color:#000080;font-weight:normal
|
||||
}
|
||||
.hljs-regexp,.hljs-link{
|
||||
color:#009926
|
||||
}
|
||||
.hljs-symbol,.hljs-bullet{
|
||||
color:#990073
|
||||
}
|
||||
.hljs-built_in,.hljs-builtin-name{
|
||||
color:#0086b3
|
||||
}
|
||||
.hljs-meta{
|
||||
color:#999;font-weight:bold
|
||||
}
|
||||
.hljs-deletion{
|
||||
background:#fdd
|
||||
}
|
||||
.hljs-addition{
|
||||
background:#dfd
|
||||
}
|
||||
.hljs-emphasis{
|
||||
font-style:italic
|
||||
}
|
||||
.hljs-strong{
|
||||
font-weight:bold}
|
||||
132
template/styl/mixins/markdown.styl
Normal file
132
template/styl/mixins/markdown.styl
Normal file
@@ -0,0 +1,132 @@
|
||||
|
||||
div.markdown-body
|
||||
.edit_btn{
|
||||
position relative
|
||||
right 0
|
||||
float right
|
||||
top 48px
|
||||
z-index 2
|
||||
}
|
||||
padding 30px 35px 30px 35px
|
||||
word-wrap break-word
|
||||
font-family "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif
|
||||
font-size 14px
|
||||
line-height 1.6
|
||||
color #333
|
||||
@media mq-mobile
|
||||
padding-right 0
|
||||
&>*:first-child
|
||||
margin-top 0 !important
|
||||
strong
|
||||
font-weight bold
|
||||
hr
|
||||
border-top 1px solid #CACACA
|
||||
border-width 1px 0 0 0
|
||||
em
|
||||
font-style italic
|
||||
img
|
||||
max-width 100%
|
||||
h1,h2,h3,h4,h5,h6
|
||||
position relative
|
||||
margin-top 1em
|
||||
margin-bottom 16px
|
||||
font-weight bold
|
||||
line-height 1.4
|
||||
a
|
||||
display none
|
||||
&:hover a
|
||||
display inline
|
||||
color #000
|
||||
font-size 85%
|
||||
h1,h2
|
||||
border-bottom 1px solid #eee
|
||||
h1
|
||||
font-size 2.25em
|
||||
line-height 1.2
|
||||
padding-bottom 0.3em
|
||||
h2
|
||||
padding-bottom 0.3em
|
||||
font-size 1.50em
|
||||
line-height 1.225
|
||||
// border-bottom:1px solid #DEDEDE
|
||||
blockquote
|
||||
padding 0 15px
|
||||
color #777
|
||||
border-left 4px solid #ddd
|
||||
margin 0;
|
||||
&>:last-child
|
||||
margin-bottom 0
|
||||
&>:first-child
|
||||
margin-top 0
|
||||
p,blockquote,ul,ol,dl,table,pre
|
||||
margin-top 0;
|
||||
margin-bottom 16px
|
||||
ul,ol
|
||||
padding-left 1.4em
|
||||
list-style:initial
|
||||
ol
|
||||
list-style-type decimal
|
||||
ol ol, ul ol
|
||||
list-style-type lower-roman
|
||||
ul ul ol, ul ol ol, ol ul ol, ol ol ol
|
||||
list-style-type lower-alpha
|
||||
pre
|
||||
padding 1em
|
||||
overflow auto
|
||||
background-color #f7f7f9
|
||||
border-radius 3px
|
||||
word-break break-all
|
||||
word-wrap break-word
|
||||
font "Source Code Pro", Consolas, Menlo, Monaco, "Courier New", monospace
|
||||
font-size 0.93em
|
||||
-webkit-overflow-scrolling touch
|
||||
code
|
||||
background-color transparent
|
||||
color inherit
|
||||
line-height 1.4
|
||||
display block
|
||||
font-size 1em
|
||||
// code:before,code:after,tt:before,tt:after
|
||||
// letter-spacing 0
|
||||
// content ""
|
||||
code,tt
|
||||
padding 0
|
||||
padding-bottom 2px
|
||||
margin 0 3px
|
||||
vertical-align top
|
||||
background-color #EDEDF7
|
||||
border-radius 4px
|
||||
padding-left 3px
|
||||
padding-right 3px
|
||||
font-size 14px
|
||||
color #6F5990
|
||||
padding-top 2px
|
||||
// code:before,code:after,tt:before,tt:after
|
||||
// content "\00a0"
|
||||
// vertical-align text-top
|
||||
// display inline-block
|
||||
// width 0px
|
||||
table
|
||||
width 100%
|
||||
border-collapse collapse
|
||||
border-spacing 0
|
||||
max-width 100%
|
||||
display block
|
||||
background-color transparent
|
||||
th,td
|
||||
border 1px solid #ddd
|
||||
padding 4px 10px
|
||||
th
|
||||
font-weight bold
|
||||
background #F3F3F3
|
||||
tr:nth-child(2n)
|
||||
background-color #f8f8f8
|
||||
tbody
|
||||
background #fff
|
||||
|
||||
// markdown 增强样式
|
||||
.markdown-body
|
||||
.task-list-item
|
||||
padding 0
|
||||
li
|
||||
list-style-type none
|
||||
22
template/styl/mixins/reset.styl
Normal file
22
template/styl/mixins/reset.styl
Normal file
@@ -0,0 +1,22 @@
|
||||
body,html,ul,li,p{
|
||||
margin 0
|
||||
padding 0
|
||||
}
|
||||
body,html{
|
||||
font-size 12px
|
||||
font-family 'HanHei SC','PingFang SC','Helvetica Neue','Helvetica','STHeitiSC-Light','Arial',sans-serif
|
||||
}
|
||||
html{
|
||||
-webkit-tap-highlight-color rgba(0,0,0,0)
|
||||
}
|
||||
a {
|
||||
text-decoration none
|
||||
&:hover{
|
||||
color #1bb800
|
||||
}
|
||||
}
|
||||
* {
|
||||
box-sizing border-box
|
||||
}
|
||||
|
||||
$border-color = #D5D5D5
|
||||
Reference in New Issue
Block a user