Skip to content

v1.5.2 — 等号串就是高亮标记;客户端会自报版本

Choose a tag to compare

@DedsecLemon DedsecLemon released this 26 Oct 12:45
· 4 commits to main since this release

v1.5.2 — 等号串就是高亮标记;客户端会自报版本

反馈是「没有看到字体有变色」。查下来 <mark> 一直是有生成的,问题出在标记的写法:

本库把横幅写成 五个等号:

===== 一、核心功能模式 =====

严格按 == 解析时,取的是开头那串等号的最后两个,于是渲染成:

===<mark> 一、核心功能模式 </mark>===

底色其实是有的,但一行里还留着 === —— 看起来就"没变"。同理毛选里那句是六个等号。

改了什么

  • 标记改成 两侧各 2 个以上等号,并且整串吃掉:==x==、===== x =====、======x======= 都渲染成一个干净的 <mark>
  • 两条防线保留:标记内容里不许有 =(所以 ==== 这种裸等号串不会变成高亮)与不许有反引号(孤立的比较符 a == b 不会跟后面的 == 配对、把代码段吞进去)
  • 客户端现在会自报版本:GET /dsh-obsidian/diag 里多了 build 字段。这次排查正卡在"页面到底跑的是不是我刚装的包",以后这问题一次请求就能回答

一个意外的发现

排查时发现 diag 已经报 build: "1.5.2" —— 也就是正在跑的页面早就拿到了新包(client-plugin 的 HMR 接收器会自动重载客户端改动)。所以"没变色"不是版本没到,是标记写法与预期不一致。

可验证

  • render-check 新增:五等号、六等号横幅都渲染成一个 mark、多余等号不残留、裸等号串不误判
  • 仓库与本机副本 render / mount(25) 全绿

说明:这是背景高亮,不是字体变色

Obsidian 的 == 渲染成 <mark>,视觉上是琥珀色底纹(40% 透明),文字颜色不变。如果你想要的是文字本身变色,那是另一种样式,说一声我改成强调色文字。

English

v1.5.2 — the <mark> was being produced all along; the problem was how this vault writes its markers. Its banners are ===== 一、核心功能模式 ===== (five equals) and one banner in 毛选 uses six. A strict == rule took the last two equals of the opening run as its marker and left === on both sides — the tint was there, but the line still began with equals, which reads as "nothing changed".

Markers are now a run of two or more equals on each side, stripped whole, so ==x==, ===== x ===== and ======x======= all render as one clean <mark>. The two guards stay: the body may contain neither = (a bare run is not a highlight) nor a backtick (a lone a == b cannot swallow a code span). The client half also reports CLIENT_BUILD through /dsh-obsidian/diag — the first question this report raised was "is the page running the installed bundle", and the answer was yes (the client-plugin HMR receiver had already picked the change up).

Note: Obsidian's == is a background highlight (a 40% amber tint), not a font-colour change. If coloured text is what you expected, say so and it becomes one line.