refactor(update): render release notes natively, dropping MarkdownUI#21
Conversation
Parse the appcast item's Markdown into blocks in LockIMEKit (ReleaseNotes.blocks) — heading, bullet list, paragraphs — and render them with SwiftUI Text, which draws the inline bold/code/links each block carries. This replaces the MarkdownUI / swift-cmark / NetworkImage dependency graph; the arm64 Release binary shrinks 2.2 MB to 1.4 MB. Verified against all 18 published releases: no unsupported constructs, and any block kind outside the generated subset degrades to a readable paragraph. Layer GitHub's reading conveniences on top: link @username to its profile, and relabel …/pull/N, …/issues/N, …/compare/A...B as #N and the bare ref range, keeping each link target (an email local part or an @ inside inline code is not taken for a mention). The empty-notes fallback is now a localized catalog string covering every SupportedLanguage. The update-lab notes are enriched so make update-test-* visibly exercises the renderer.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughThe PR removes the third-party MarkdownUI library and replaces it with a custom Markdown rendering pipeline. A new 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/LockIME/UI/UpdateWindowView.swift`:
- Around line 62-67: In the release notes conditional block, replace the simple
`.isEmpty` check on `model.releaseNotesMarkdown` with a whitespace-safe check
using `.trimmingCharacters(in: .whitespaces).isEmpty` to properly handle
whitespace-only strings as empty. Additionally, replace the literal string "No
release notes." in the Text view with a localized string obtained through
`state.loc(...)` or the appropriate `AppKitStrings` accessor, ensuring the
localization key is added to `Localizable.xcstrings` for all supported languages
per the coding guidelines for AppKit-hosted surfaces.
In `@Sources/LockIMEKit/Updates/ReleaseNotes.swift`:
- Around line 119-124: The host validation on line 119 uses
hasSuffix("github.com"), which will incorrectly match malicious domains like
"evilgithub.com" and then relabel their URLs to appear as trusted GitHub
references (the "`#N`" format on line 124 or compare text on line 124). Replace
the loose hasSuffix check with a strict equality check for "github.com"
(optionally also allowing "www.github.com") to ensure only actual GitHub URLs
get the shortened label treatment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: adad3ab1-a523-45ae-ac7e-f96575ef9796
📒 Files selected for processing (8)
Sources/LockIME/Localizable.xcstringsSources/LockIME/UI/ReleaseNotesTheme.swiftSources/LockIME/UI/ReleaseNotesView.swiftSources/LockIME/UI/UpdateWindowView.swiftSources/LockIMEKit/Updates/ReleaseNotes.swiftTests/LockIMEKitTests/ReleaseNotesTests.swiftproject.ymlscripts/update-lab/update-lab.sh
💤 Files with no reviewable changes (2)
- Sources/LockIME/UI/ReleaseNotesTheme.swift
- project.yml
Restrict compactGitHubLabel to github.com and its subdomains so a look-alike host like evilgithub.com cannot have its …/pull/N link relabeled to a trusted-looking #N while keeping the untrusted target. Trim the release notes before the empty check so whitespace-only notes show the fallback instead of a blank section (ReleaseNotes.blocks already drops to zero blocks for such input). Signed-off-by: Kevin Cui <bh@bugs.cc>
The README never mentioned the config import/export feature shipped in #18, nor that the app now downloads as a sub-3 MB .dmg. Add both to the Features list and drop the stale MarkdownUI mention from the Architecture section (removed in #21). All nine language variants are updated together to keep the translations in sync. Signed-off-by: Kevin Cui <bh@bugs.cc>
Parse the appcast item's Markdown into blocks in LockIMEKit (ReleaseNotes.blocks) — heading, bullet list, paragraphs — and render them with SwiftUI Text, which draws the inline bold/code/links each block carries. This replaces the MarkdownUI / swift-cmark / NetworkImage dependency graph; the arm64 Release binary shrinks 2.2 MB to 1.4 MB. Verified against all 18 published releases: no unsupported constructs, and any block kind outside the generated subset degrades to a readable paragraph.
Layer GitHub's reading conveniences on top: link @username to its profile, and relabel …/pull/N, …/issues/N, …/compare/A...B as #N and the bare ref range, keeping each link target (an email local part or an @ inside inline code is not taken for a mention). The empty-notes fallback is now a localized catalog string covering every SupportedLanguage. The update-lab notes are enriched so make update-test-* visibly exercises the renderer.