Hello Macduan

Welcome to Macduan’s Little Site built with Hexo!
记录Macduan的生活,技术点滴

Travel

Hexo Simple Guide

折腾了ruby+jekyll,还是决定用hexo,安装主题方便,容易配置。

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Clean

1
$ hexo clean

cactus tips

本站使用cactus这种极简主题,

增加分类,Tags
需要自己做一些配置比如,默认是Home,几个,自己增加Nav之后,需要自己增加分类主要是参考这里

修改theme/cactus/_config.yml中默认的Nav

1
2
3
4
5
6
7
nav:
Home: /
Technology: /categories/technology
Life: /categories/life
Archives: /archives/
Tags: /tags/
About: /about

$ hexo new page technology,会产生一个文件,${BLOG_HOME}/source/technology/index.md

$ hexo new page life,会产生一个文件,${BLOG_HOME}/source/life/index.md

$ hexo new page tags,会产生一个文件,${BLOG_HOME}/source/life/index.md,但是对于tags必须将type: "tags"添加到这个文件的头中,

1
2
3
4
5
---
title: tags
date: 2016-11-27
type: "tags"
---

在theme/cactus/source/images中是主页的logo,网页标签的favicon之类的图片,可以使用这个favicon制作网站制作自己的favicon替换这个目录中的图片。

增加mermaid支持

使用mermaid在markdown中画流程图,类图非常方便,结合官方文档,与这个使用cactus主题的mermaid配置的经验

安装插件

1
2
cd ${BLOG_HOME}
npm install hexo-filter-mermaid-diagrams --save

配置
${BLOG_HOME}/themes/cactus/_config.yml中增加如下配置

1
2
3
4
5
6
mermaid: ## mermaid url https://github.com/knsv/mermaid
enable: true
version: "9.0.0"
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
#startOnload: true // default true
theme: forest

${BLOG_HOME}/themes/cactus/layout/_partial/style.ejs的后面追加如下配置

1
2
3
4
5
6
7
8
<% if (theme.mermaid.enable) { %>
<script src='https://unpkg.com/mermaid@<%= theme.mermaid.version %>/dist/mermaid.min.js'></script>
<script>
if (window.mermaid) {
mermaid.initialize({theme: 'forest'});
}
</script>
<% } %>

配置完成之后下面这一段代码会生成下图

1
2
3
4
5
6
7
8
graph LR

root(cluster environment) --> L1-1(faults)
L1-1 --> L2-1(node failure)
L1-1 --> L2-2(stragglers, aka slow nodes)
root --> L1-2(parallelism)
root --> L1-3(multi-tenant)
root --> L1-4(elastic, dynamic scale up and down)
graph LR

root(cluster environment) --> L1-1(faults)
    L1-1 --> L2-1(node failure)
    L1-1 --> L2-2(stragglers, aka slow nodes)
root --> L1-2(parallelism)
root --> L1-3(multi-tenant)
root --> L1-4(elastic, dynamic scale up and down)