markdown-hexo使用

What is Hexo?

Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other languages) and Hexo generates static files with a beautiful theme in seconds.

Installation

It only takes few minutes to set up Hexo. If you encounter a problem and can’t find the solution here, pleasesubmit a GitHub issue and I’ll try to solve it.

Requirements

Installing Hexo is quite easy. However, you do need to have a couple of other things installed first:

安装node.js
参考官网:http://nodejs.cn/

安装git插件:
Install hexo-deployer-git.
$ npm install hexo-deployer-git --save
配置_config.yml
deploy:
  type: git
  repo: <repository url>
  branch: [branch]
  message: [message]

初始化markdown项目:

安装初始化

npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

markdown相关语法:

 语法手册:https://www.zybuluo.com/mdeditor?url=https://www.zybuluo.com/static/editor/md-help.markdown

Markdown语法

1、分段: 两个回车

扫描二维码关注公众号,回复: 487337 查看本文章

2、换行 两个空格 + 回车

3、标题 # ~ ###### 井号的个数表示几级标题,即Markdown可以表示一级标题到六级标题

4、引用 >

5、列表 * , + , - , 1. ,选其中之一,注意后面有个空格

6、代码区块 四个空格 开头

7、链接 [文字](链接地址)

8、图片 ![图片说明](图片地址) ,图片地址可以是本地路劲,也可以是网络地址

9、强调 **文字** , __文字__ , _文字_ , *文字*

10、代码 ```,``

下面来看看例文,你就马上明白,怎么来使用这些符号来写好一篇自己的博文了。

例文

在线编辑器例文: 传送门

Mou编辑器: 下载地址

你先试试,用Markdown怎么去些自己的文章,有了例子,还是很容易上手的。

hexo常用命令

我们在前面的已经略微的接触了一些hexo的命令,如 hexo new "my blog" ,hexo server 等。下面来介绍一下我们经常会用到的hexo命令

1、新建

 
hexo new "my blog"

新建的文件在 hexo/source/_posts/my-blog.md

2、编译

 
hexo generate

一般部署上去的时候都需要编译一下,编译后,会出现一个 public 文件夹,将所有的md文件编译成html文件

3、开启本地服务

 
hexo server

这个命令,我之前已经用过了,开启本地hexo服务用的

4、部署

 
hexo deploy

部署到git上的时候,需要用这个命令,下一篇中,我们会使用到这个命令

5、清除 public

hexo clean

当 source 文件夹中的部分资源更改过之后,特别是对文件进行了删除或者路径的改变之后,需要执行这个命令,然后重新编译。

hexo官网:https://hexo.io/ 

使用教程:http://www.zipperary.com/2013/05/28/hexo-guide-1/

猜你喜欢

转载自yanan0628.iteye.com/blog/2295988