blog笔记
文章编写常用
用makedown语法编写博客说实话真的挺好玩的,语法也还算简单,写这一篇的目的是防止我自己忘记,嘛,有些代码用完一次,第二次就忘干净了,这里记录一下用过的语法,以后也方便找。
添加新文章:
—-
添加新文章:
在hexo根目录下右键 选择 Git bash here.
键入:
hexo new "文章文件名称"
使用notepad++打开
文章插入code栏:
—-
在md文件内插入:
<pre><code>write something here</code></pre><br>
实际效果
write something here
↓
文章居中文字:
<blockquote class="blockquote-center">write something here</blockquote>
效果:
write something here
文章插入图片:
<img src="/path/to/image" class="[class names]" title="[width] [height] [title text [alt text]]">
[width]替换为宽度数字 ,[height]替换为高度
简易:

“1”替换为图片名称,并将图片文件放入根目录下 public\upload_image 目录下(没有即自行创建)
简易-2:

↓
博文置顶
md文件内 top值增大,越大越靠前。0即为安时间排序。
前置需求:
修改 hero-generator-index 插件,把文件:node_modules/hexo-generator-index/lib/generator.js 内的代码替换为:
'use strict';
var pagination = require('hexo-pagination');
module.exports = function(locals){
var config = this.config;
var posts = locals.posts;
posts.data = posts.data.sort(function(a, b) {
if(a.top && b.top) { // 两篇文章top都有定义
if(a.top == b.top) return b.date - a.date; // 若top值一样则按照文章日期降序排
else return b.top - a.top; // 否则按照top值降序排
}
else if(a.top && !b.top) { // 以下是只有一篇文章top有定义,那么将有top的排在前面(这里用异或操作居然不行233)
return -1;
}
else if(!a.top && b.top) {
return 1;
}
else return b.date - a.date; // 都没定义按照文章日期降序排
});
var paginationDir = config.pagination_dir || 'page';
return pagination('', posts, {
perPage: config.index_generator.per_page,
layout: ['index', 'archive'],
format: paginationDir + '/%d/',
data: {
__index: true
}
});
};
↓
强调
文字加粗
在需要加粗的文字前后添加“ * ”
形式有下:
*强调*(斜体)
**强调**(加粗)
__强调__(加粗)
效果:
强调(斜体)
强调(加粗)
强调(加粗)
↓
语法参考链接如下
makedown简易入门 ※※※
感谢以上文章作者。