韩老魔的博客0XHANNIBA1 · NOTES

配置并使用使用Typora编写文章

一、配置

1.配置 hexo 启动资源文件夹

1
2
cd ~/my-blog
vi _config.yml

修改和追加:

1
2
3
4
5
post_asset_folder: true           # 你已经启用,确认仍为 true

marked:
prependRoot: true # 给路径自动加站点根
postAsset: true # <—— 关键:让图片指向对应文章目录

2.确认依赖

1
2
npm uninstall hexo-asset-image      # 旧插件先卸掉,防止冲突
npm install hexo-renderer-marked@latest --save

3.配置 typora 图片设置

打开 typora-设置-图像:

(1)插入图片时:选择【复制到指定路径】

(2)图片存储路径:./${filename}

image-20250717144034933

二、开写

1.新建文章

1
hexo new "working_notes"

2.直接部署

1
hexo clean && hexo g && hexo d

3.编辑内容

使用Typora打开working_notes.md文件编辑即可,创建文章时终端会显示md文件路径

image-20250809175727048

三、额外配置

1.设置图标

(1)图标网站找一个图标,用 gpt 制作成32*32大小,将图片存在source/images/中,命名为favicon.png

image-20250811162013851

(2)编辑themes/typography/layout/partial/head.pug,原内容是href=“images/favicon.png, xxx”,添加一个/

image-20250811165900282

(3)去看看 themes/typography/source/images 里是否有 favicon.png;如果没有,就从现有图标处复制一份放进去

Tweaks