Preview checker: a `<title>` written over several lines keeps its line break and indentation
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
从 src/lib/meta-fetcher.ts 中的 parseMetaTags() 开始,查找现有的标题解析测试,包括保留 meta content 内部空白的测试。为标题中的多行和重复 ASCII 空白添加一个会失败的测试,然后检查 meta content 的行为是否保持不变。标题符合浏览器合并空白的行为,并且列出的检查、测试和构建命令均通过,即表示完成。
由索引模型根据 Issue 内容生成。
描述
parseMetaTags() in src/lib/meta-fetcher.ts only trims the ends of the <title> text (decodeEntities(titleMatch[1].trim())), so a title written over several lines keeps the line break and the indentation in the middle. Browsers strip and collapse that whitespace (document.title gives Cutting cold starts in half with Fluid Compute | Acme Blog), but the checker keeps it:
parseMetaTags(`<title>
Cutting cold starts in half with Fluid Compute
| Acme Blog
</title>`, 'https://example.com').title
// "Cutting cold starts in half with Fluid Compute\n | Acme Blog"
That 58-character title gets "Title is 72 chars (recommended: under 70)" from analyzeMeta(), and the Google Search preview (resolvePlatformPreviews() in src/lib/platform-specs.ts) cuts it at 60 characters in the middle of the whitespace, so | Acme Blog never shows.
What to do
- After decoding entities, collapse each run of ASCII whitespace (space, tab, newline, carriage return, form feed) in the title to one space and strip it from both ends, the way
document.titledoes. isn't ASCII whitespace, so it stays. - Leave meta
contentvalues as they are. They keep their inner whitespace on purpose (the "trims decoded meta content while preserving internal whitespace" test).
Acceptance criteria
- The title above comes out as
Cutting cold starts in half with Fluid Compute | Acme Blog, and tabs or double spaces inside a title collapse the same way - Meta
contentvalues and every existingparseMetaTagstest stay as they are - A test that fails on the current code
-
npm run check,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #NUM in the description.
- 主要语言
- TypeScript
- 星标
- 8
- 派生
- 4
- 平均合并
- 8 小时 44 分钟
- 30 天内合并 PR
- 159
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/ogcops 的其他 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
codercops/ogcops#394 · 3 条评论 ·
维护者通常 1 天内回复
-
[Bug] “Copy Recommended Meta Tags” generates an unusable placeholder image URL可能重新可做 @CreatorguyS 于 7 天前认领,目前没有进行中的 PR。 未关闭bug enhancement
难度 2/5 1-3 小时 新手友好度 72/100
codercops/ogcops#378 · 4 条评论 ·
维护者通常 1 天内回复
-
bug good first issue
难度 3/5 1-2 天 新手友好度 78/100
维护者通常 1 天内回复
-
Add the Do and Don't tutorial template (`tutorial-do-dont`)可能已有人在做 @Ravindar-Amogh-Gummadavelly 于 7 天前认领。 未关闭good first issue templates
codercops/ogcops#355 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
codercops/ogcops#341 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 86/100
ranxianglei/billion-context#5893 ·
维护者通常 1 天内回复
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))未关闭
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
enhancement security severity:low
难度 2/5 1-3 小时 新手友好度 83/100
Battle-Cattle/BCUK-Bot-4#959 ·
维护者通常 1 天内回复
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apart可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭account-pool bug gui
难度 2/5 1-3 小时 新手友好度 76/100
lidge-jun/opencodex#8286 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复