Skip to content

fix: 优化 Markdown 渲染与文章摘要展示;文章列表支持md图片+iframe代码不显示至文章列表页+文章详情页&列表页换行无效的问题。#519

Open
FreeL00P wants to merge 5 commits into
openRin:mainfrom
FreeL00P:main

Conversation

@FreeL00P

@FreeL00P FreeL00P commented Jun 6, 2026

Copy link
Copy Markdown

md图片渲染+iframe代码不显示至文章列表页+文章详情页&列表页换行无效的问题。

概述

  • 支持在文章 Markdown 中渲染 iframe 嵌入内容,并增加懒加载、沙盒限制和统一样式。
  • 通过 remark-breakswhitespace-pre-line 保留 Markdown 正文与信息流摘要中的换行。
  • 生成摘要时先清理 Markdown、HTML 嵌入、代码块、图片和格式语法,避免摘要中出现源码或原始 Markdown。
  • 优化封面图提取逻辑,同时支持 Markdown 图片和 HTML <img> 标签。
  • 当图片缺少元数据或宽高比时,信息流卡片仍能正常展示封面图。

主要变更

  • 为客户端补充 remark-breaks 依赖,保证 CI 和构建环境依赖完整。
  • 新增服务端 stripMarkdown 工具,用于生成更干净的纯文本摘要。
  • 更新信息流列表、相邻文章和搜索结果的摘要兜底逻辑,改为基于纯文本截断。
  • 在 Markdown 渲染器中新增 iframe 组件处理,补充安全相关属性。
  • 为信息流卡片图片增加默认 16 / 9 宽高比兜底。

FreeL00P added 5 commits June 5, 2026 23:56
…ng cover images

- Add iframe component handler in markdown renderer with sandbox security
- Create stripMarkdown utility to clean raw markdown for feed summaries
- Update extractImageWithMetadata to support HTML img tags for cover images
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