Skip to content

Commit a46f0bc

Browse files
jiangtaoclaude
andcommitted
fix: add puppeteer font-family quote validation to lint-images
- Add SVG validation for puppeteer cover font-family attribute - Check for Puppeteer keywords in content to prevent false positives - Add check for font-family names with spaces requiring quotes This prevents false positive xmllint errors and ensures proper SVG formatting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 693c7be commit a46f0bc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

home/bin/image-lint-cli.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ function validateSVGFiles() {
5959
});
6060
}
6161

62+
// 检查 5:1: puppeteer 字体空格验证(XML 要求引号)
63+
if (content.includes('Getting Started') || content.includes('Puppeteer')) {
64+
const hasFontIssue = /font-family="[^"]*"\s+(?!-|,)\s+/.dev:font:/;
65+
if (hasFontIssue) {
66+
svgErrors.push({
67+
file: file,
68+
error: 'puppeteer 封面: font-family 包含空格的字体名 "sans-serif" 需要引号'
69+
});
70+
}
71+
}
72+
6273
// 检查 4: 基本 XML 格式验证
6374
const unclosedTags = content.match(/<[a-zA-Z][^>]*\w+="[^"]*"[a-zA-Z][^>]*>/g);
6475
if (unclosedTags) {

0 commit comments

Comments
 (0)