style(代码配色): printf 里的 %d、%.2f 和 Python f-string 的 { } 有了自己的颜色;Python 的 from / as / with 和 import 一个颜色,跟 VS Code 一样

lezer 把整个字符串当一个词,占位符另外扫一遍(shared/formatPlaceholder.ts),编辑器挂装饰、
静态代码拆 span,用同一份正则。Python 解析器补了几条 styleTags,编辑器和静态代码共用。
CodeEditor.vue 原来自己抄了一份语言选择,改成用 languageExtension。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-13 20:18:29 +08:00
1 parent a559af0aa9
commit 3b04afc275
6 files changed
+134 -14

No files matched your search

+13
View File
@@ -67,6 +67,19 @@ html.dark {
color: var(--code-invalid);
}
/* 字符串里的 %d,见 shared/formatPlaceholder.ts。静态代码是同一个 span 上的两个类名,
编辑器里是两层 span、谁包谁不一定,所以三种写法都要 */
.tok-format,
.tok-format .tok-string,
.tok-string .tok-format {
color: var(--code-variable);
}
.tok-format-py,
.tok-format-py .tok-string,
.tok-string .tok-format-py {
color: var(--code-keyword);
}
/* 以下只有 Markdown 编辑器用得到 */
.tok-heading {
color: var(--code-heading);