Skip to content

feat: 打赏页面的收款方式支持markdown - #626

Open
sanmussh wants to merge 1 commit into
CuteLeaf:masterfrom
sanmussh:sponsor-markdown
Open

sanmussh wants to merge 1 commit into
CuteLeaf:masterfrom
sanmussh:sponsor-markdown

Conversation

@sanmussh

@sanmussh sanmussh commented Sep 6, 2026 •

Copy link
Copy Markdown

每个收款方式的描述都支持 Markdown,有两种写法:

  • 直接写在 TS 的 description 中:用反引号包住多行 Markdown。
  • 使用独立 .md 文件:放在 src/content/sponsor/ 下,再设置 descriptionFile: "文件名.md"。

两者同时设置时,优先使用 descriptionFile。

Sourcery 摘要

为赞助商付款方式启用丰富的 Markdown 描述,包括可复用的外部内容文件。

新功能:

  • 支持从内联配置或 src/content/sponsor/ 下的专用文件中为赞助商付款方式添加 Markdown 描述,文件中的描述优先级更高。

增强功能:

  • 在赞助商付款方式卡片中渲染经过清理的 Markdown 描述,并改进换行和布局。
Original summary in English

Summary by Sourcery

Enable rich Markdown descriptions for sponsor payment methods, including reusable external content files.

New Features:

  • Add Markdown support for sponsor payment method descriptions from inline configuration or dedicated files under src/content/sponsor/, with file descriptions taking precedence.

Enhancements:

  • Render sanitized Markdown descriptions with improved wrapping and layout within sponsor method cards.

(cherry picked from commit 18883720443651b24b4d70635cc39f400fd9c21a)
@netlify

netlify Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for demo-firefly ready!

Name Link
🔨 Latest commit f211218
🔍 Latest deploy log https://app.netlify.com/projects/demo-firefly/deploys/6a9d3599b730170008d24ada
😎 Deploy Preview https://deploy-preview-626--demo-firefly.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai

sourcery-ai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

审查者指南

打赏页面现在可以将每种收款方式的描述解析为经过清理的 GFM Markdown,支持使用内联配置或 src/content/sponsor/ 下的独立文件,并通过新增配置字段表达文件来源和优先级。

打赏描述 Markdown 渲染时序图

sequenceDiagram
    participant Config as sponsorConfig.methods
    participant Page as sponsor.astro
    participant Files as sponsor Markdown files
    participant Marked
    participant Sanitizer as sanitizeHtml
    participant Markdown as Markdown component

    Config->>Page: filter enabled methods
    Page->>Files: import.meta.glob descriptionFile
    Page->>Page: select descriptionFile over description
    alt descriptionFile is missing
        Page-->>Page: throw Error
    else description source exists
        Page->>Marked: parse(source, { async: false })
        Marked-->>Page: GFM HTML
        Page->>Sanitizer: sanitizeHtml(html, allowed img)
        Sanitizer-->>Page: safe descriptionHtml
        Page->>Markdown: render descriptionHtml
    end
Loading

文件级变更

变更 详细信息 文件
为打赏方式描述增加 Markdown 渲染、文件加载和安全过滤能力。
  • 支持从配置中的 description 读取 Markdown,或从 src/content/sponsor/ 下的 .md 文件读取内容
  • descriptionFile 与 description 同时存在时优先使用文件,并在文件不存在时抛出明确错误
  • 使用 marked 解析 GFM Markdown,并通过 sanitize-html 限制输出标签,同时保留图片支持
  • 将渲染后的 HTML 通过通用 Markdown 组件展示,并调整描述区域的布局与长文本换行样式
src/pages/sponsor.astro
扩展打赏方式配置类型,以声明 Markdown 描述的来源。
  • 标注 description 支持 Markdown 多行字符串
  • 新增可选的 descriptionFile 字段,并明确其相对路径与优先级
src/types/sponsorConfig.ts

提示与命令

与 Sourcery 交互

  • **触发新的审查:**在拉取请求中评论 @sourcery-ai review。
  • **继续讨论:**直接回复 Sourcery 的审查评论。
  • **根据审查评论创建 GitHub issue:**回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复审查评论 @sourcery-ai issue,以根据该评论创建 issue。
  • **生成拉取请求标题:**在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,以随时生成或重新生成标题。
  • **生成拉取请求摘要:**在拉取请求正文中任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,以随时生成或重新生成摘要。
  • **生成审查者指南:**在拉取请求中评论 @sourcery-ai guide,即可随时生成或重新生成审查者指南。
  • **解决所有 Sourcery 评论:**在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,此功能非常有用。
  • **忽略所有 Sourcery 审查:**在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从新的审查开始,这项功能尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

打赏页面现可将每种收款方式的描述解析为经过清理的 GFM Markdown,支持内联配置或 src/content/sponsor/ 下的独立文件,并通过新增配置字段表达文件来源和优先级。

Sequence diagram for sponsor description Markdown rendering

sequenceDiagram
    participant Config as sponsorConfig.methods
    participant Page as sponsor.astro
    participant Files as sponsor Markdown files
    participant Marked
    participant Sanitizer as sanitizeHtml
    participant Markdown as Markdown component

    Config->>Page: filter enabled methods
    Page->>Files: import.meta.glob descriptionFile
    Page->>Page: select descriptionFile over description
    alt descriptionFile is missing
        Page-->>Page: throw Error
    else description source exists
        Page->>Marked: parse(source, { async: false })
        Marked-->>Page: GFM HTML
        Page->>Sanitizer: sanitizeHtml(html, allowed img)
        Sanitizer-->>Page: safe descriptionHtml
        Page->>Markdown: render descriptionHtml
    end
Loading

File-Level Changes

Change Details Files
为打赏方式描述增加 Markdown 渲染、文件加载与安全过滤能力。
  • 支持从配置中的 description 读取 Markdown,或从 src/content/sponsor/ 下的 .md 文件读取内容
  • descriptionFile 与 description 同时存在时优先使用文件,并在文件不存在时抛出明确错误
  • 使用 marked 解析 GFM Markdown,并通过 sanitize-html 限制输出标签,同时保留图片支持
  • 将渲染后的 HTML 通过通用 Markdown 组件展示,并调整描述区域的布局与长文本换行样式
src/pages/sponsor.astro
扩展打赏方式配置类型以声明 Markdown 描述来源。
  • 标注 description 支持 Markdown 多行字符串
  • 新增可选 descriptionFile 字段,并明确其相对路径与优先级
src/types/sponsorConfig.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好——我已经审阅了你的更改,整体看起来很棒!

Sourcery 评估

已批准。


Sourcery 对开源项目免费——如果你喜欢我们的审查结果,请考虑分享它们 ✨
Original comment in English

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant