hexo在使用過程中有很多地方還是需要排坑的,我把排過的坑記錄??一下
首先推薦一個主題,真的很贊https://www.haomwei.com/technology/maupassant-hexo.html
稀飯!
hexo插入圖片問題
(1)主頁配置文件_config.yml:
post_asset_folder: true
(2)在hexo文件夾下執(zhí)行命令:
npm install hexo-asset-image --save
//安裝一個可以上傳本地圖片的插件
(3)生成markdown
hexo new "xxxx"
(4)在/source/_posts生成一個和markdown “xxxx”同名的文件夾
(5)直接將圖片插入到相關(guān)位置即可:
a. 需要修改成相對文件位置
b. 用html語言格式可以修改圖片大?。?/p>
<img src="xxxx/xxxx.png" width="400px" />
hexo公式問題
(1)更換hexo的markdown公式渲染引擎,在hexo文件夾下執(zhí)行命令:
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
(2)在博客根目錄下,找到node_modules\kramed\lib\rules\inline.js,將escape參數(shù)和em參數(shù)做如下修改:
// escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/,
escape: /^\\([`*\[\]()#$+\-.!_>])/
// em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/
(3)在主題中開啟hexo開關(guān),在主題themes對應(yīng)目錄下,找到_config.yml配置文件,做如下修改:
mathjax:
enable: true
per_page: true
(4)在文章的front-matter打開mathjax開關(guān):
---
title:
date:
tags:
mathjax: true
--
(5)重啟hexo:
hexo c
hexo g
hexo d
我不會說我其實更換了一個支持公式渲染的主題 嘻嘻
hexo跨域訪問問題
我最近用的主題,可愛的程序員在設(shè)計的時候引入了cdn,這樣會加快訪問,但是會造成不穩(wěn)定因素,比如,剛剛fix的一個問題就是:cdn不穩(wěn)定,導(dǎo)致很多css樣式被chrome攔截(存在跨域訪問的問題)。我將對應(yīng)主題下 /layout/_partial/head.pug下引入的cdn換了一個更穩(wěn)定的版本,成功解決。
Reference:
1.https://github.com/CodeFalling/hexo-asset-image
2.https://blog.csdn.net/sugar_rainbow/article/details/57415705