mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
fix(ui): activate CJK-friendly markdown parsing
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user