mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 11:12:54 +02:00
fix: spacing between headings
This commit is contained in:
parent
fd8cc74627
commit
1eb43060d5
3 changed files with 13 additions and 5 deletions
|
@ -38,17 +38,19 @@ i18n 对我来说是必需的。因为我之前发过一篇英文的 [三星优
|
|||
|
||||
于是我开始给主题添加 i18n 功能。既然要加,不能只支持中英两种语言,肯定得支持多种语言。根据 Astro 官方指南,我需要给每种语言都新建一个文件夹,这也太麻烦了。
|
||||
|
||||

|
||||

|
||||
|
||||
接着我找到官方推荐的 i18n 插件,都试了一遍,效果都不理想,而且很麻烦。后来刷到一个推特帖子,我发现这个方案不错,非常地巧妙,而且不需要安装额外的插件。
|
||||
|
||||

|
||||

|
||||
|
||||
于是我按照这个思路,花了一周时间终于是弄出一套方案。本地测试成功,非常开心。虽然我看不懂 Cursor 是怎么实现的,但能跑起来就行了。
|
||||
|
||||
结果问题就来了。部署网站到 Netlify 时一直报错,我也看不懂报错信息,给 AI 修也修不好。当时感觉心灰意冷,搞了这么久,还是失败了嘛…
|
||||
|
||||
无奈之下,我想到了向作者 Moeyua 发邮件求助。
|
||||
|
||||

|
||||

|
||||
|
||||
## 转折
|
||||
|
||||
|
@ -60,7 +62,7 @@ i18n 对我来说是必需的。因为我之前发过一篇英文的 [三星优
|
|||
|
||||
三个月过去了,也就有了现在你所看到的样子。
|
||||
|
||||

|
||||

|
||||
|
||||
## 细节
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ export function rehypeImgToFigure() {
|
|||
&& node.children.length === 1
|
||||
&& node.children[0].tagName === 'img'
|
||||
&& node.children[0].properties.alt
|
||||
&& !node.children[0].properties.alt.startsWith('_')
|
||||
) {
|
||||
const child = node.children[0]
|
||||
const altText = child.properties.alt
|
||||
|
|
|
@ -80,7 +80,12 @@
|
|||
.heti :where(h3:has(+ p)),
|
||||
.heti :where(h4:has(+ p)),
|
||||
.heti :where(h5:has(+ p)),
|
||||
.heti :where(h6:has(+ p)) {
|
||||
.heti :where(h6:has(+ p)),
|
||||
.heti :where(h1:has(+ h2)),
|
||||
.heti :where(h2:has(+ h3)),
|
||||
.heti :where(h3:has(+ h4)),
|
||||
.heti :where(h4:has(+ h5)),
|
||||
.heti :where(h5:has(+ h6)) {
|
||||
--at-apply: 'mb-3';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue