145 lines
6.4 KiB
Markdown
145 lines
6.4 KiB
Markdown
|
||
1. 目前图片只能识别![[imagefile]],无法识别,把markdownown文件中转化为[[imagefile]]。
|
||
如:转为![[2025ZK1-7.jpg]]
|
||
✅
|
||
|
||
2. 读取markdown的frontmatter属性,文章标题取title和作者取author内容。
|
||
以附件2025ZK1.md为例:
|
||
提取以下信息(忽略两端的“”):
|
||
- 如tiltle不为空,文章title不使用文件名,使用: 6月特种兵式观展
|
||
- 如果author不为空,公众号文章作者: 大童。
|
||
|
||
- , ![[name.ext]]不分优先级,看哪个在文章的最前面,取最前面这个作为封面图片
|
||
✅
|
||
|
||
3. 预处理markdown文件:
|
||
对{{<gallery dir="/img/guanzhan/1" figcaption="毕业展"/>}}{{<load-photoswipe>}}或{{<gallery dir="/img/guanzhan/1"/>}}{{<load-photoswipe>}}
|
||
- 获取dir中的内容,如"/img/guanzhan/1",与PREPATH拼接,全局定义PRE_PATH=/Users/gavin/myweb/static
|
||
图片所在路径:PREPATH+"/img/guanzhan/1",即/Users/gavin/myweb/static/img/guanzhan/1。
|
||
- 这个/Users/gavin/myweb/static/img/guanzhan/1路径下图片<5张,取出所有图片; >n张,任意取出n张。n=NUM_PIC作为全局定义。
|
||
- 比如n=1,取出的图片为xx.jpg,那么把{{<gallery dir="/img/guanzhan/1" figcaption="毕业展"/>}}{{<load-photoswipe>}}替换为![[xx.jpg]]
|
||
如n=2,取出的图片为xx.jpg,yy.png,那么把{{<gallery dir="/img/guanzhan/1" figcaption="毕业展"/>}}{{<load-photoswipe>}}替换为:
|
||
![[xx.jpg]]
|
||
![[yy.png]]
|
||
✅
|
||
|
||
3.
|
||
对如下:
|
||
{{<gallery>}}
|
||
{{<figure src="/img/晋中晋北行程.jpeg" caption="晋中晋北行程" >}}
|
||
{{<figure src="/img/晋中晋北行程-2.png" caption="晋中晋北行程" >}}
|
||
{{<figure src="/img/晋中晋北行程-3.png" caption="晋中晋北行程" >}}
|
||
{{</gallery>}}
|
||
替换为
|
||
![[晋中晋北行程.jpeg]]
|
||
![[晋中晋北行程-2.jpeg]]
|
||
![[晋中晋北行程-3.jpeg]]
|
||
|
||
src可能使用link:
|
||
{{<gallery>}}
|
||
{{<figure link="/img/2025ZK12.jpg" caption="">}}
|
||
{{<figure link="/img/2025ZK12-2.jpg" caption="">}}
|
||
{{</gallery>}}
|
||
替换为
|
||
![[2025ZK12.jpg]]
|
||
![[2025ZK12-2.jpg]]
|
||
✅
|
||
|
||
4.
|
||
参考以下代码,渲染[fig content/],|| content,||r content,||g content,||b content等标签:
|
||
`\[fig([^>]*?)/\]` `<span style="font-style: italic; font-size: 14px; background-color: #f5f5f5; padding: 2px;">$1</span>`
|
||
`\|\| (.*)` `<p style="font-family:'Microsoft YaHei',sans-serif;background-color:#E5E4E2 ;padding:10px;border-radius:20px;line-height:30px;">$1</p>`
|
||
`\|\|r (.*)` `<p style="font-family:'Microsoft YaHei',sans-serif;color:white;background-color:#6F4E37;padding:10px;border-radius:20px;line-height:30px;">$1</p>`
|
||
`\|\|g (.*)` `<p style="font-family:'Microsoft YaHei',sans-serif;background-color:#BCE954;padding:10px;border-radius:20px;line-height:30px;">$1</p>`
|
||
`\|\|b (.*)` `<p style="font-family:'Microsoft YaHei',sans-serif;background-color:#B6B6B4;padding:10px;border-radius:20px;line-height:30px;">$1</p>`
|
||
`\|\|y (.*)` `<p style="font-family:'Microsoft YaHei',sans-serif;background-color:#FFFFC2;padding:10px;border-radius:20px;line-height:30px;">$1</p>`
|
||
|
||
||连续多行只渲染第一行,举例:
|
||
|| content1
|
||
content2
|
||
content3
|
||
渲染为:
|
||
<p style="font-family:'Microsoft YaHei',sans-serif;font-size:14px; background-color:#FFFFC2;padding:10px;border-radius:20px;line-height:30px;">content1</p>
|
||
content2
|
||
content3
|
||
而不是:
|
||
<p style="font-family:'Microsoft YaHei',sans-serif;font-size:14px; background-color:#FFFFC2;padding:10px;border-radius:20px;line-height:30px;">content1
|
||
content2
|
||
content3
|
||
</p>
|
||
✅
|
||
|
||
5. 文章没有图片,封面使用一张默认图片(设计一张)。
|
||
✅
|
||
|
||
6. 修改右侧菜单排版。单篇内容,去掉(暂时不动):
|
||
- 封面设置(使用文中图片或者默认图片,默认图片路径在全局配置,转化为![[cover.png]],所以还是会在obsidian定义的img目录下获取)
|
||
如:obsidian设置 - 文件与链接 - 附件文件夹路径 - static/img
|
||
|
||
7. 修改代码,全局配置中如果“在工具栏展示样式选择“选择关闭时,统一使用全局设置中的"插件设置-默认样式和代码高亮"中的设置。
|
||
✅
|
||
|
||
8. 在h1前使用||h1 来增加修饰编号,01,02,03……
|
||
|
||
9. 支持选中多篇文章,邮件"发布到公众号"。问题obsidian只能连续选择,是不能跳着选。
|
||
改变思路:通过database按tags筛选文件,筛选出文件,执行命令。
|
||
增加命令 - 批量发布
|
||
```
|
||
在obsidian中通过database筛选出文章,送到发布公众号:
|
||
views:
|
||
- type: table
|
||
name: 表格
|
||
filters:
|
||
and:
|
||
- file.tags.contains("篆刻")
|
||
order:
|
||
- file.name
|
||
|
||
实现:
|
||
1. 回车键执行“应用筛选”
|
||
2. 支持鼠标框选文件
|
||
|
||
修正问题:当滚动条下拉后,无法框选
|
||
|
||
鼠标框选选中,control+鼠标框选取消选中
|
||
```
|
||
✅
|
||
|
||
10. 默认选择
|
||
- “允许留言” ✅
|
||
- “原创”
|
||
|
||
11. gallery短代码增加是否使用dir中的所有图片的开关。mppickall=1,选取dir中的所有图片,mppickall=0,按“选取图片数”配置选取图片数量。
|
||
{{<gallery dir="/img/guanzhan/1" figcaption="毕业展" mppickall=1/>}}{{<load-photoswipe>}}
|
||
{{<gallery dir="/img/guanzhan/1"/> mppickall=1}}{{<load-photoswipe>}}
|
||
(hugo中发布会忽略mppickall信息)
|
||
✅
|
||
|
||
12. 图片旋转问题❓在mac预览和obsidian中查看都正常的图片。上传公众号被左旋90度❓note-to-mp中没有旋转逻辑。
|
||
exiftool -Orientation -n image.jpg
|
||
Orientation : 6
|
||
• 1 → 正常方向
|
||
• 3 → 倒过来
|
||
• 6 → 右转 90°
|
||
• 8 → 左转 90°
|
||
|
||
Orientation : 1 -- 没有问题。
|
||
Orientation : 6 -- 图片左旋90度,需右选90才正常。
|
||
|
||
需求:
|
||
- 在mac预览和obsidian中查看都正常的图片。上传公众号被左旋90度。通过exiftool -Orientation -n image.jpg查看显示,Orientation : 6。
|
||
在插件中需要判断Orientation的值,除了Orientation为1不需要旋转,其他情况依据该值执行旋转操作:
|
||
1 → 不需要旋转
|
||
3 → 旋转180度
|
||
6 → 右转 90°
|
||
8 → 左转 90°
|
||
没有解决❗️
|
||
- 在mac预览和obsidian中查看都正常的图片。上传公众号被左旋90度。通过exiftool -Orientation -n image.ext查看显示,Orientation : 6。
|
||
为了规避这个问题,图片不做旋转处理,直接转为png上传公众号。解决。因为PNG不带orientation信息。
|
||
✅
|
||
|
||
- 封面图片没有正确旋转。
|
||
公众号上传仍然有图片旋转问题,同样需要取png图片避免旋转问题
|
||
✅
|
||
|