Repository navigation
Conversation
- FF-18: use low-collision feed sentinels and preserve unmatched sentinels instead of emitting undefined - FF-34: quote and escape new-post titles; drop stray YAML comma - FF-38: compute reading time after diagram plugins clear source text - FF-39: skip wiki-card and image paragraphs when deriving excerpts - FF-40: convert only block images to figures, replacing deprecated center wrapper with CSS - FF-41: base64-encode mailto addresses as UTF-8 and decode bytes in the browser - FF-42: match Mermaid fence language case-insensitively - FF-43: normalize mermaid-container className array/string forms
👷 Deploy request for demo-firefly pending review.Visit the deploys page to approve it
|
审阅者指南实现折叠 feed 中的空白字符,但不要替换作者提供的类似哨兵值的文本,也不要破坏受保护的代码块。
生成摘要时,排除自定义渲染的段落和包含图片的段落。
仅将独立的块级图片转换为 figure,并对受保护的电子邮件链接进行 UTF-8 安全的编码和解码。
匹配 Mermaid 围栏语言时忽略大小写,并检测各种受支持 className 表示形式中的 Mermaid 容器。
为生成的 YAML 标题加引号并进行转义,以便特殊字符不会改变文章的原始标题。
UI直接为 figure 和图片网格 figure 添加样式,替代已移除的居中包装器样式。
配置在计算阅读时间之前运行 Mermaid 和 PlantUML 转换,以便图表源代码不会计入字数。
提示和命令与 Sourcery 互动
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideImplementationCollapse feed whitespace without replacing author-provided sentinel-like text or corrupting protected code blocks.
Exclude custom-rendered and image-containing paragraphs when deriving excerpts.
Convert only standalone block images to figures, and apply UTF-8-safe encoding and decoding to protected email links.
Match Mermaid fence languages without regard to case and detect Mermaid containers across supported className representations.
Quote and escape generated YAML titles so special characters preserve the original post title.
UIStyle figures and image-grid figures directly, replacing the removed center-wrapper styling.
ConfigurationRun Mermaid and PlantUML transformations before reading-time calculation so diagram source is excluded from word counts.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
你好——我发现了 4 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/utils/feed-utils.ts" line_range="65" />
<code_context>
*/
function collapseFeedWhitespace(html: string): string {
const protectedBlocks: string[] = [];
+ const sentinel = (index: number) => `@@FIREFLY_PRE_BLOCK_9d4f2a_${index}@@`;
const masked = html.replace(
/<pre[\s\S]*?<\/pre>|<code[\s\S]*?<\/code>/gi,
</code_context>
<issue_to_address>
**Literal feed text is replaced**
When rendered feed text contains a sentinel matching an index in the protected-block list, `collapseFeedWhitespace` restores every matching sentinel as a protected block, including sentinels that came from authored text. RSS and Atom content therefore show the block instead of the literal text.
Restore only placeholders inserted by the masking step, using placeholders that cannot collide with authored text.
Also at `src/utils/feed-utils.ts:76-80`.
</issue_to_address>
### Comment 2
<location path="src/plugins/rehype-figure.mjs" line_range="39-41" />
<code_context>
+ imgNode = child;
+ }
+ } else if (
+ node.tagName === "img" &&
+ parent.tagName !== "p" &&
+ parent.tagName !== "figure"
+ ) {
+ imgNode = node;
</code_context>
<issue_to_address>
**Inline images break paragraph layout**
When a paragraph contains an image wrapped in a link or another inline element, `rehypeFigure` treats the nested image as block-level and replaces it with a `<figure>` inside its inline parent. This creates invalid flow-content nesting, breaks the linked image’s layout, and can add an unintended caption.
Only convert images to figures when they are block images, and leave images nested in inline elements unchanged.
</issue_to_address>
### Comment 3
<location path="src/plugins/rehype-email-protection.mjs" line_range="50-51" />
<code_context>
}
return `
- const decodedEmail = atob(encodedEmail);
+ const decodedEmail = new TextDecoder().decode(
+ Uint8Array.from(atob(encodedEmail), (c) => c.charCodeAt(0)),
+ );
`;
</code_context>
<issue_to_address>
**Non-ASCII mailto addresses are corrupted**
When a profile or banner mailto address contains non-ASCII characters, `MAILTO_ONCLICK_SCRIPT` decodes the base64 bytes with `atob` as Latin-1; the `TextDecoder` change in the rehype plugin does not affect these links. The browser opens a corrupted mailto address.
Update `MAILTO_ONCLICK_SCRIPT` to decode the base64 bytes as UTF-8.
</issue_to_address>
### Comment 4
<location path="astro.config.mjs" line_range="306" />
<code_context>
? [remarkAdmonitionToBlockquoteCallout]
: []),
remarkMath,
- remarkReadingTime,
remarkWikiLink,
remarkImageGrid,
</code_context>
<issue_to_address>
**Wiki cards inflate reading counts**
When an article contains a standalone wiki link that resolves to a card, `remarkReadingTime` now runs after `remarkWikiLink` replaces standalone wiki-link paragraphs with cards, so `toString(tree)` counts the card title, description, and tags instead of just the source link; the displayed word count and JSON-LD `wordCount` are inflated.
Run reading-time calculation after the diagram plugins but before other plugins that replace or add text content.
</issue_to_address>Sourcery 评估
需要人工审核。 有 4 个问题需要先处理;如果标题转义有误,新生成的 Markdown 文件在脚本回滚后仍可能保留格式错误的标题;这些文件数量有限,可以手动编辑或重新生成。其他更改主要影响渲染,可以通过回滚流水线更改来修正。
阻塞性问题:src/utils/feed-utils.ts:65、src/plugins/rehype-figure.mjs:41、src/plugins/rehype-email-protection.mjs:51、astro.config.mjs:306
Original comment in English
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/utils/feed-utils.ts" line_range="65" />
<code_context>
*/
function collapseFeedWhitespace(html: string): string {
const protectedBlocks: string[] = [];
+ const sentinel = (index: number) => `@@FIREFLY_PRE_BLOCK_9d4f2a_${index}@@`;
const masked = html.replace(
/<pre[\s\S]*?<\/pre>|<code[\s\S]*?<\/code>/gi,
</code_context>
<issue_to_address>
**Literal feed text is replaced**
When rendered feed text contains a sentinel matching an index in the protected-block list, `collapseFeedWhitespace` restores every matching sentinel as a protected block, including sentinels that came from authored text. RSS and Atom content therefore show the block instead of the literal text.
Restore only placeholders inserted by the masking step, using placeholders that cannot collide with authored text.
Also at `src/utils/feed-utils.ts:76-80`.
</issue_to_address>
### Comment 2
<location path="src/plugins/rehype-figure.mjs" line_range="39-41" />
<code_context>
+ imgNode = child;
+ }
+ } else if (
+ node.tagName === "img" &&
+ parent.tagName !== "p" &&
+ parent.tagName !== "figure"
+ ) {
+ imgNode = node;
</code_context>
<issue_to_address>
**Inline images break paragraph layout**
When a paragraph contains an image wrapped in a link or another inline element, `rehypeFigure` treats the nested image as block-level and replaces it with a `<figure>` inside its inline parent. This creates invalid flow-content nesting, breaks the linked image’s layout, and can add an unintended caption.
Only convert images to figures when they are block images, and leave images nested in inline elements unchanged.
</issue_to_address>
### Comment 3
<location path="src/plugins/rehype-email-protection.mjs" line_range="50-51" />
<code_context>
}
return `
- const decodedEmail = atob(encodedEmail);
+ const decodedEmail = new TextDecoder().decode(
+ Uint8Array.from(atob(encodedEmail), (c) => c.charCodeAt(0)),
+ );
`;
</code_context>
<issue_to_address>
**Non-ASCII mailto addresses are corrupted**
When a profile or banner mailto address contains non-ASCII characters, `MAILTO_ONCLICK_SCRIPT` decodes the base64 bytes with `atob` as Latin-1; the `TextDecoder` change in the rehype plugin does not affect these links. The browser opens a corrupted mailto address.
Update `MAILTO_ONCLICK_SCRIPT` to decode the base64 bytes as UTF-8.
</issue_to_address>
### Comment 4
<location path="astro.config.mjs" line_range="306" />
<code_context>
? [remarkAdmonitionToBlockquoteCallout]
: []),
remarkMath,
- remarkReadingTime,
remarkWikiLink,
remarkImageGrid,
</code_context>
<issue_to_address>
**Wiki cards inflate reading counts**
When an article contains a standalone wiki link that resolves to a card, `remarkReadingTime` now runs after `remarkWikiLink` replaces standalone wiki-link paragraphs with cards, so `toString(tree)` counts the card title, description, and tags instead of just the source link; the displayed word count and JSON-LD `wordCount` are inflated.
Run reading-time calculation after the diagram plugins but before other plugins that replace or add text content.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 4 findings to address first, and if title escaping is wrong, newly generated Markdown files can retain a malformed title after the script is reverted; those files are bounded and can be edited or regenerated. The other changes primarily affect rendering and can be corrected by reverting the pipeline changes.
Blocking findings: src/utils/feed-utils.ts:65, src/plugins/rehype-figure.mjs:41, src/plugins/rehype-email-protection.mjs:51, astro.config.mjs:306
- Collapse feed whitespace by splitting protected blocks instead of using collision-prone sentinels. - Skip inline image wrappers when creating figures. - Decode UTF-8 mailto links in inline onclick handlers. - Count reading time before wiki-card expansion but after diagram transforms.
Summary
Markdown and feed pipeline cleanup covering eight audit findings.
undefinedinto RSS/Atom output.new-postnow emits a quoted, escaped YAML title and no longer leaves a stray trailing comma that broke frontmatter parsing for titles containing:or quotes.wordCount.<figure>elements; inline images keep their paragraph, and the deprecated<center>wrapper is replaced by afigurerule and simplified.image-grid figurestyles.mailto:addresses are base64-encoded as UTF-8, with the browser decoder readingatobbytes throughTextDecoder, so non-Latin-1 addresses no longer break builds.classNameforms with exact token matching.Files
astro.config.mjs,scripts/new-post.js,src/utils/feed-utils.tssrc/plugins/remark-excerpt.js,src/plugins/rehype-figure.mjs,src/plugins/rehype-email-protection.mjs,src/plugins/remark-mermaid.js,src/plugins/rehype-mermaid.mjssrc/styles/markdown.cssVerification
corepack pnpm run check: 0 errors, 0 warnings, 0 hints.corepack pnpm exec astro build --force: 40 pages built successfully (41 with a temporary fixture post, removed afterward).corepack pnpm exec biome checkon the nine changed files: no fixes applied.undefined; inline images stay inside<p>, block/grid images become<figure>, uppercase Mermaid fences render, and no<center>wrappers remain.new-postfixture: generated frontmatter with a title containing:, quotes and a backslash parses as the original title.Sourcery 总结
加固 Markdown 和信息流处理流水线,确保在处理受保护内容、生成的元数据、图表、图片、摘要和国际化电子邮件地址时都能生成可靠的输出。
错误修复:
功能增强:
Original summary in English
Sourcery 摘要
加固 Markdown 和 feed 流水线,以可靠地生成摘要、元数据、图片、图表、邮件链接和联合发布内容。
错误修复:
增强功能:
Original summary in English
Summary by Sourcery
Harden the Markdown and feed pipelines to produce reliable excerpts, metadata, images, diagrams, email links, and syndication output.
Bug Fixes:
Enhancements: