fix(ui): activate CJK-friendly markdown parsing

This commit is contained in:
Dallin Romney
2026-08-20 21:48:40 -07:00
parent 5281b320ec
commit 09057b8a0f
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -1,5 +1,6 @@
import { asOptionalRecord } from "@openclaw/normalization-core/record-coerce";
import MarkdownIt, { type MarkdownIt as MarkdownItParser, type Token } from "markdown-it";
import markdownItCjkFriendly from "markdown-it-cjk-friendly";
import markdownItTaskLists from "markdown-it-task-lists";
import { t } from "../i18n/index.ts";
import { fileKindForPath, shortestFileLabels } from "./file-kind.ts";
@@ -147,6 +148,7 @@ export function createMarkdownParser(): MarkdownItParser {
breaks: true,
linkify: true,
});
markdownParser.use(markdownItCjkFriendly);
const defaultCodeInlineRenderer = markdownParser.renderer.rules.code_inline!;
// Enable GFM strikethrough (~~text~~) to match original marked.js behavior.
@@ -26,6 +26,10 @@ suite.define(() => {
text: [
"## Alignment check",
"",
"これは**(注記)**です",
"",
'safe<br>break and unsafe<br class="wide">markup',
"",
"- Bullet item",
"",
"1. Numbered item",
@@ -56,6 +60,9 @@ suite.define(() => {
hasText: "Alignment check",
});
await markdown.waitFor();
expect(await markdown.locator("strong", { hasText: "(注記)" }).count()).toBe(1);
expect(await markdown.locator("br").count()).toBe(1);
expect(await markdown.textContent()).toContain('unsafe<br class="wide">markup');
const geometry = await markdown.evaluate((root) => {
const textRect = (selector: string) => {