fix: spacing between headings

This commit is contained in:
radishzzz 2025-04-17 01:16:44 +01:00
parent fd8cc74627
commit 1eb43060d5
3 changed files with 13 additions and 5 deletions

View file

@ -38,17 +38,19 @@ i18n 对我来说是必需的。因为我之前发过一篇英文的 [三星优
于是我开始给主题添加 i18n 功能。既然要加,不能只支持中英两种语言,肯定得支持多种语言。根据 Astro 官方指南,我需要给每种语言都新建一个文件夹,这也太麻烦了。
![Astro 官方的 i18n 指南](https://image.radishzz.cc/birth-of-retypeset/astro-i18n-guide.webp)
![_Astro 官方的 i18n 指南](https://image.radishzz.cc/birth-of-retypeset/astro-i18n-guide.webp)
接着我找到官方推荐的 i18n 插件,都试了一遍,效果都不理想,而且很麻烦。后来刷到一个推特帖子,我发现这个方案不错,非常地巧妙,而且不需要安装额外的插件。
![推特 i18n 截图](https://image.radishzz.cc/birth-of-retypeset/twitter-i18n.webp)
![_推特 i18n 截图](https://image.radishzz.cc/birth-of-retypeset/twitter-i18n.webp)
于是我按照这个思路,花了一周时间终于是弄出一套方案。本地测试成功,非常开心。虽然我看不懂 Cursor 是怎么实现的,但能跑起来就行了。
结果问题就来了。部署网站到 Netlify 时一直报错,我也看不懂报错信息,给 AI 修也修不好。当时感觉心灰意冷,搞了这么久,还是失败了嘛…
无奈之下,我想到了向作者 Moeyua 发邮件求助。
![求助邮件](https://image.radishzz.cc/birth-of-retypeset/mail-to-moeyua.webp)
![_求助邮件](https://image.radishzz.cc/birth-of-retypeset/mail-to-moeyua.webp)
## 转折
@ -60,7 +62,7 @@ i18n 对我来说是必需的。因为我之前发过一篇英文的 [三星优
三个月过去了,也就有了现在你所看到的样子。
![Retypeset](https://image.radishzz.cc/birth-of-retypeset/retypeset-en-desktop.webp)
![_Retypeset](https://image.radishzz.cc/birth-of-retypeset/retypeset-en-desktop.webp)
## 细节

View file

@ -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

View file

@ -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';
}