安装hexo
主要采用hexo
工具本地生成技术知识库预览,hexo
使用说明;
安装hexo
必须先安装nodejs、npm
:
1 |
npm install hexo -g |
创建blog
创建一个blog
目录,进入其中执行:
1 2 3 4 5 6 7 8 9 10 11 |
hexo init npm install --save hexo-filter-sequence npm install --save hexo-filter-flowchart npm install hexo-renderer-mathjax --save npm install --save hexo-generator-feed npm install hexo-filter-mermaid-diagrams --save npm install hexo-generator-search --save # 解决TOC出现undefine问题 npm install markdown-it-named-headings --save hexo clean hexo g |
编辑_config.yml
添加以下内容:
1 2 3 4 5 6 7 8 9 10 11 12 |
flowchart: options: # options used for `drawSVG` sequence: options: theme: css_class: mathjax: enable: true #修改主题 theme: next |
使用next
主题,下载主题到themes
中:
1 |
git clone https://github.com/iissnan/hexo-theme-next themes/next |
让next
支持mermaid
,在themes/next/layout/_partials/head/custom-head.swig
中添加:
1 2 |
<script src="{{ url_for('https://unpkg.com/mermaid@'+theme.mermaid.version + '/dist/mermaid.min.js') }}"></script> <script type="text/javascript">mermaid.initialize({startOnLoad:true,flowchart:{useMaxWidth:false, htmlLabels:true}});</script> |
支持本地搜索,编辑thmem
1 2 |
local_search: enable: true #默认为false |
创建tags
、categories
:
1 2 |
hexo new page tags hexo new page categories |
编辑source/tags/index.md
,改为:
1 2 3 4 |
title: 标签 date: 日期 type: "tags" comments: false |
编辑source/categories/index.md
,改为:
1 2 3 4 |
title: 分类 date: 日期 type: "categories" comments: false |
将技术知识库仓库checkout
,
1 |
svn co http://192.168.7.3/svn/drops |
复制drops
下的文件内容到 blog/source/_posts/
目录下;
1 |
cp -rf drops /blog/source/_posts/ |
执行hexo s
启动本地服务,通过该方式进行预览。
使用hexo
生成md
文件:
1 |
hexo new "文章标题" |
该动作会直接执行文件创建,会在source/_post/
下生成一个”文章标题.md”的文件。