fix(mindspace): 生成页面统一使用中文友好无衬线字体
页脚品牌行、纯文字页面模板与技能提示词此前用 Georgia/Times 衬线体,中文渲染 效果差;统一改为系统无衬线字体栈(PingFang SC / Microsoft YaHei 等)。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,8 @@ export const MINDSPACE_PAGE_TAG_ATTR = 'data-mindspace-page-tag';
|
||||
export const MINDSPACE_PAGE_TAG_PLATFORM_BRAND = 'platform-brand';
|
||||
export const PLATFORM_BRAND_TEXT = 'TKMind · 智趣';
|
||||
export const PLATFORM_BRAND_STYLE_ID = 'mindspace-platform-brand-style';
|
||||
export const MINDSPACE_PAGE_FONT_STACK =
|
||||
'-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif';
|
||||
|
||||
const PLATFORM_BRAND_VISIBILITY_STYLE = `<style id="${PLATFORM_BRAND_STYLE_ID}">
|
||||
[data-mindspace-page-tag="${MINDSPACE_PAGE_TAG_PLATFORM_BRAND}"] {
|
||||
@@ -9,9 +11,10 @@ const PLATFORM_BRAND_VISIBILITY_STYLE = `<style id="${PLATFORM_BRAND_STYLE_ID}">
|
||||
opacity: 1 !important;
|
||||
visibility: visible !important;
|
||||
color: #9aa3a0 !important;
|
||||
font-family: ${MINDSPACE_PAGE_FONT_STACK} !important;
|
||||
font-size: 12px !important;
|
||||
font-weight: 600 !important;
|
||||
letter-spacing: 0.08em !important;
|
||||
font-weight: 500 !important;
|
||||
letter-spacing: 0.02em !important;
|
||||
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
</style>`;
|
||||
|
||||
@@ -39,6 +39,7 @@ test('injectPlatformBrandVisibilityStyle adds readable brand css', () => {
|
||||
const result = injectPlatformBrandVisibilityStyle(html);
|
||||
assert.match(result, new RegExp(`id="${PLATFORM_BRAND_STYLE_ID}"`));
|
||||
assert.match(result, /opacity:\s*1 !important/);
|
||||
assert.match(result, /font-family:.*PingFang SC/);
|
||||
});
|
||||
|
||||
test('ensurePlatformBrandFooter appends brand line when marker is missing', () => {
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ function renderPreviewHtml(page) {
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src 'none'; base-uri 'none'; form-action 'none'">
|
||||
<title>${escapeHtml(page.title)}</title>
|
||||
<style>
|
||||
:root { color: #18211d; background: #f5f0e5; font-family: Georgia, "Times New Roman", serif; }
|
||||
:root { color: #18211d; background: #f5f0e5; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; padding: clamp(24px, 7vw, 88px); background: radial-gradient(circle at 90% 0, #d8e8df, transparent 34rem), #f5f0e5; }
|
||||
article { width: min(820px, 100%); margin: 0 auto; padding: clamp(28px, 6vw, 72px); border: 1px solid #d7d0c1; border-radius: 28px; background: rgba(255,253,247,.94); box-shadow: 0 24px 70px rgba(45,53,47,.12); }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>越南旅游指南</title>
|
||||
<style>
|
||||
:root { --accent: #2f6f57; --bg: #f4f0e7; }
|
||||
body { margin: 0; font-family: Georgia, serif; background: var(--bg); color: #18211d; line-height: 1.7; }
|
||||
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: var(--bg); color: #18211d; line-height: 1.7; }
|
||||
main { max-width: 720px; margin: 0 auto; padding: 48px 24px 72px; }
|
||||
h1 { font-size: 2.2rem; margin-bottom: 0.5rem; color: var(--accent); }
|
||||
.lead { color: #5f6963; margin-bottom: 2rem; }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<title>越南旅游指南</title>
|
||||
<style>
|
||||
:root { --accent: #ff6b35; --accent2: #24243e; --bg: #fff8f2; }
|
||||
body { margin: 0; font-family: Georgia, serif; background: linear-gradient(160deg, var(--bg), #ffe8d6); color: #18211d; line-height: 1.7; }
|
||||
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: linear-gradient(160deg, var(--bg), #ffe8d6); color: #18211d; line-height: 1.7; }
|
||||
.hero { position: relative; height: 280px; overflow: hidden; }
|
||||
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(36,36,62,0.55), transparent 60%); }
|
||||
|
||||
@@ -239,6 +239,7 @@ npm run check:mindspace-cover
|
||||
- 完整 \`<!DOCTYPE html>\`,\`lang="zh-CN"\`
|
||||
- 移动端友好:\`<meta name="viewport" content="width=device-width, initial-scale=1">\`
|
||||
- 深色/浅色与内容一致;主色在 CSS 与 mindspace-cover 中保持一致
|
||||
- 中文页面优先使用系统无衬线字体:\`-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif\`;**避免** Georgia、Times 等西文衬线体
|
||||
- 页脚平台品牌行**必须**使用 \`data-mindspace-page-tag="platform-brand"\` 标记,显示为 **TKMind · 智趣**,**禁止**使用邮箱或 \`tkmind.ai\`
|
||||
|
||||
\`\`\`html
|
||||
|
||||
Reference in New Issue
Block a user