All notable changes to this project will be documented in this file.
本项目的所有重要更改都将记录在此文件中。
- 📐 Whole-List Top/Bottom Padding / 整个列表头尾内边距 - Added
listTopPaddingandlistBottomPaddingso the entire list wrapper can apply configurable top/bottom spacing without changing per-item layout / 新增listTopPadding和listBottomPadding,支持为整个列表 wrapper 配置顶部/底部间距,而不改变每个列表项自身布局
- 📏 Height Measurement Stabilization / 高度测量稳定性修复 - Hardened
notifyHeightChangewith width fallback, frame-height fallback, and transient-zero suppression to avoid0 ↔ actual heightjumps during initial layout or rapid updates / 加固notifyHeightChange:增加宽度兜底、基于 frame 的高度回退,以及临时0高度抑制,避免初始布局或快速更新时出现0 ↔ 实际高度来回跳变 - 🌊 Paragraph-Level Streaming Fallback / 段落级流式切分回退 - Real streaming now emits single-heading or heading-less Markdown by paragraph boundaries when heading-based segmentation is unavailable, while skipping fenced code blocks / 当标题数量不足以用于模块切分时,真流式模式现在会按段落边界输出单标题或无标题 Markdown,同时跳过 fenced code block 内部的空段切分
- 🐛 Ordered List Height Consistency / 有序列表高度一致性 - Fixed an issue where the first ordered-list item could be stretched taller than following items in some stack/reuse layouts / 修复部分 Stack/ReUse 场景下首个有序列表项高度被异常拉高、与后续项不一致的问题
- 🧱 List Layout Constraint Hardening / 列表布局约束加固 - Changed list wrapper bottom constraint to
<=and strengthened vertical hugging/compression priorities to avoid extra height being absorbed by the first item / 调整列表外层底部约束为<=,并增强垂直 hugging/compression,避免额外高度被首项吸收 - 🧹 List Invisible Text Cleanup / 列表不可见文本清理 - Added normalization and cleanup for invisible list text nodes (leading/trailing newlines, zero-width/control whitespace) to prevent phantom list item height / 增加列表不可见文本节点的归一化与清理(首尾换行、零宽字符、控制/空白字符),避免“幽灵高度”撑开列表项
- 📊 Markdown Table Column Alignment / Markdown 表格列对齐支持 - Added support for table alignment syntax (
:---,:---:,---:) and applied alignment per column / 新增:---、:---:、---:对齐语法解析,并按列应用左/中/右对齐 - 🛠 Malformed Table Auto-Fix / 异常表格自动修复 - Added
autoFixMalformedTables(default:true) to normalize common broken table output (isolated|, accidental blank lines inside tables) / 新增autoFixMalformedTables(默认true),自动修正常见异常输出(孤立|、表格块内误空行) - ✍️ Configurable Line Spacing / 行间距配置化 - Added
lineSpacingconfiguration forbody,heading,quote,codeBlock, replacing fixed line spacing constants / 新增lineSpacing配置(body、heading、quote、codeBlock),替代固定行间距常量
- 🔗 Table Link Tap Callback / 表格链接点击回调 - Keep
UILabelin table cells for better scrolling performance; link taps now route through cell selection and existingonLinkTapcallback chain / 表格 cell 保持UILabel(滚动性能更优),通过 cell 点击识别链接并复用onLinkTap回调链路 ⚠️ Configuration Cleanup / 配置项收敛 - Removed table-level alignment override config; table text alignment now follows Markdown syntax (fallback: left) / 移除表格文本对齐覆盖配置项;表格文本对齐以 Markdown 语法为准(默认左对齐)
- 🐛 Touch Routing Fix / 触摸路由修复 - Fixed gesture conflict where outer TextKit tap handling could swallow table attachment touches and prevent link callbacks / 修复外层 TextKit 点击手势可能抢占表格附件触摸,导致表格链接点击回调不生效
- 🎨 Comprehensive Configuration Options / 全面配置项支持 - Added extensive customization for all Markdown elements / 新增所有 Markdown 元素的详细配置:
- LaTeX Formula / LaTeX 公式:
latexFontSize,latexAlignment(left/center/right),latexBackgroundColor,latexPadding - Blockquote / 引用块:
blockquoteBackgroundColor,blockquoteBarWidth,blockquoteContentSpacing,blockquoteContentPadding - Table / 表格:
tableMinColumnWidth,tableMaxColumnWidth,tableRowHeight,tableCellPadding,tableSeparatorHeight - List / 列表:
listItemSpacing,listMarkerMinWidth,listMarkerSpacing - Details / 折叠块:
detailsSummaryFont,detailsSummaryTextColor,detailsSummaryMinHeight,detailsContentPadding,detailsSpacing - Syntax Highlighting / 代码高亮:
syntaxColors,syntaxColorsDarkwithSyntaxHighlightColorsstruct (keyword, string, number, comment, type, function, property, preprocessor) / 支持SyntaxHighlightColors结构体 - TOC / 目录:
tocTextColor
- LaTeX Formula / LaTeX 公式:
tableRowBackgroundColor: Now properly applied to table rows / 现已正确应用于表格行
- Updated README with complete configuration options / 更新 README 完善所有配置选项文档
- 🚀 Typewriter Append Mode / 打字机追加模式 - Add
.appendmode with throttled height updates to reduce layout jumps during cell streaming / 新增.append模式,并对高度更新节流,减少 Cell 流式输出时的布局跳变 - ⚙️ Streaming Config / 流式配置项 - Expose
typewriterTextMode,typewriterHeightUpdateInterval,streamMinModuleLength/ 提供typewriterTextMode、typewriterHeightUpdateInterval、streamMinModuleLength - 🧹 Memory Cleanup / 内存清理 - Add cache clearing helpers and Mermaid WebView cleanup to reduce retained memory / 增加缓存清理与 Mermaid WebView 释放逻辑,降低页面退出后的驻留内存
- 🧪 Example Update / 示例更新 - AI chat stream uses safer LaTeX normalization (code regions ignored) and recommended config / AI 对话流式 LaTeX 规范化更安全(忽略代码区域),并给出推荐配置
- 📝 Docs Update / 文档更新 - Refresh README content / 更新 README 内容
- 🐛 SPM Fix / SPM 修复 - Fix simulator build error in Swift Package Manager example project / 修复 Swift Package Manager 示例在模拟器上的编译问题
- 🐛 Crash Fix / 崩溃修复 - Serialize
swift-markdownparsing to avoidcmark_parser_attach_syntax_extensionrace crash in concurrent renders / 串行化swift-markdown解析,避免并发渲染触发崩溃
- 🧹 Reuse Safety / 复用安全 - Add
resetForReuse()to clear internal caches/state forUITableViewCellreuse scenarios / 新增resetForReuse()清理内部缓存与状态,适配UITableViewCell复用场景 - 🧪 Example Update / 示例更新 - Add crash reproduction screen and incremental row insert demo for table view usage / 增加崩溃复现页面与表格场景的逐条插入演示
- 🐛 Bug Fix - Fixed potential crash when processing Unicode characters (emoji, CJK characters) in streaming mode / 修复流式渲染处理 Unicode 字符(emoji、中日韩字符)时可能崩溃的问题
MarkdownStreamBuffer.extractModule: Use safe string index withlimitedByto prevent out-of-bounds crash / 使用limitedBy安全获取字符串索引,防止越界崩溃TypewriterEngine.calculateDelay: Use safe string index to prevent crash when calculating delay for special characters / 使用安全索引获取字符,防止计算特殊字符延迟时崩溃
- 🚀 Real Streaming Support / 真流式渲染支持 - New
MarkdownStreamBufferfor intelligent real-time streaming from network/LLM APIs / 新增MarkdownStreamBuffer智能流式缓冲器,支持网络/LLM API 实时流式渲染- Smart module detection: automatically detects complete Markdown blocks (headings, code blocks, tables, LaTeX) / 智能模块检测:自动识别完整的 Markdown 块
- Handles incomplete structures: waits for closing tags before rendering / 未闭合结构处理:等待闭合标签后再渲染
- Incremental rendering: renders complete modules immediately while buffering incomplete content / 增量渲染:完整模块立即渲染,未完成内容继续缓冲
- 💫 Smart Waiting Indicator / 智能等待动画 - In real streaming mode, automatically shows waiting animation when TypewriterEngine queue is empty and no network data arrives / 真流式模式下,当 TypewriterEngine 队列为空且网络数据未到达时,自动显示等待动画
- 🏗️ Code Refactoring / 代码重构 - Extracted
MarkdownTextViewTK2,MarkdownStreamBuffer, andTypewriterEngineinto separate files for better maintainability / 将相关类提取到独立文件,提升代码可维护性
- 🐛 Streaming Fixes / 流式修复 - Multiple fixes for real streaming mode stability and rendering issues / 多项真流式模式稳定性和渲染问题修复
- 🐛 Bug Fix - Fixed code blocks not rendering properly in real streaming mode when content arrives in multiple chunks / 修复真流式模式下代码块分块到达时无法正确渲染的问题
- 🚀 Instant Loading / 秒开优化 - Significantly optimized loading speed with ultra-fast first screen rendering / 大幅优化加载速度,首屏渲染极速完成
- 🔌 Enhanced Custom Extensions / 自定义扩展增强 - New
MarkdownCodeBlockRendererprotocol for custom code block rendering (e.g., Mermaid diagrams) / 新增代码块渲染器协议,支持 Mermaid 等图表渲染 - 🎨 Mermaid Support / Mermaid 支持 - Example project now includes Mermaid diagram renderer supporting flowcharts, mind maps, and more / 示例项目新增 Mermaid 图表渲染器
- ⚡ CPU Optimization / CPU 优化 - Streaming mode with nested style rendering now uses much less CPU (iPhone 17 Pro simulator peak < 56%, average 30%) / 流式模式下 CPU 使用率大幅降低
- 🎉 Initial release / 首次发布
- ✅ Full Markdown syntax support / 完整 Markdown 语法支持
- ✅ 20+ language code highlighting / 20+ 种语言代码高亮
- ✅ Automatic table of contents generation / 自动目录生成
- ✅ Dark mode support / 深色模式支持
- ✅ High-performance asynchronous rendering / 高性能异步渲染