Skip to content

feat: support opt-in remote Markdown images - #1

Merged
lurenyang418 merged 1 commit into
mainfrom
agent/remote-markdown-images-v0.1.4
Aug 9, 2026
Merged

feat: support opt-in remote Markdown images#1
lurenyang418 merged 1 commit into
mainfrom
agent/remote-markdown-images-v0.1.4

Conversation

@lurenyang418

Copy link
Copy Markdown
Contributor

Summary

  • add an opt-in setting for loading remote Markdown images in the app preview
  • load only HTTP(S) images with bounded streaming downloads, MIME/image validation, timeouts, and existing pixel/byte limits
  • preserve bounded local image loading and keep Quick Look remote images disabled
  • bump the app and extension to version 0.1.4, build 5

Root cause

The preview previously routed every image through the local-only attachment resolver, so remote HTTP(S) images were rejected even though the policy exposed a remote-resource flag.

Validation

  • swift test — 94 tests passed
  • scripts/verify-host.sh Debug — passed
  • git diff --check — passed

The pre-existing uncommitted README change was intentionally left out of this PR.

@lurenyang418
lurenyang418 marked this pull request as ready for review August 9, 2026 05:57
Copilot AI lite review requested due to automatic review settings August 9, 2026 05:57
@lurenyang418
lurenyang418 merged commit 3591e08 into main Aug 9, 2026
3 checks passed
@lurenyang418
lurenyang418 deleted the agent/remote-markdown-images-v0.1.4 branch August 9, 2026 05:57

Copilot AI 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.

Pull request overview

Adds an opt-in “remote Markdown images” capability to the in-app Markdown preview by plumbing an editor setting into the Markdown rendering policy and introducing an HTTP(S) attachment loader, while keeping Quick Look’s rendering path unchanged and bumping version/build metadata.

Changes:

  • Add allowsRemoteImages setting (persistence + settings import/export) and expose it in the settings UI.
  • Route Markdown preview image attachment loading through a new loader that can fetch HTTP(S) images when policy allows.
  • Update localization strings and bump app/extension version/build values.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/TildeEditorTests/EditorSettingsTests.swift Verifies the new allowsRemoteImages setting persists and round-trips via snapshot export/import.
Tests/TildeCoreTests/MarkdownPolicyTests.swift Extends policy tests to cover enabling remote resources.
Sources/TildeMarkdown/SecureAttachmentLoader.swift Adds a Markdown-aware attachment loader plus a remote HTTP(S) image loader with MIME + pixel/byte validation.
Sources/TildeMarkdown/MarkdownPreviewView.swift Switches preview to the new attachment loader and forces refresh when remote-resource policy toggles.
Sources/TildeEditor/EditorSettingsView.swift Adds a toggle for “Load remote images” with explanatory caption text.
Sources/TildeEditor/EditorSettings.swift Implements the new persisted setting and includes it in settings snapshots.
Sources/TildeCore/Resources/zh-Hans.lproj/Localizable.strings Adds localized strings for the new toggle and description.
Sources/TildeCore/Resources/en.lproj/Localizable.strings Adds English strings for the new toggle and description.
Sources/TildeApplication/DocumentRootView.swift Plumbs the new setting into MarkdownPolicy for the preview view.
scripts/build-dmg.sh Updates default VERSION to 0.1.4.
Host/TildeHost.xcodeproj/project.pbxproj Bumps MARKETING_VERSION to 0.1.4 and build to 5 for app + extension.
Host/App/Tilde.entitlements Enables the app sandbox network client entitlement needed for remote fetches.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +107 to +126
struct MarkdownAttachmentLoader: AttachmentLoader {
let local: SecureAttachmentLoader
let policy: MarkdownPolicy

func attachment(
for url: URL,
text: String,
environment: ColorEnvironmentValues
) async throws -> LocalImageAttachment {
switch url.scheme?.lowercased() {
case "http", "https":
guard policy.allowsRemoteResource(url) else {
throw SecureAttachmentLoader.Blocked.resourceLoadingDisabled
}
return try await RemoteImageAttachmentLoader(policy: policy).attachment(
for: url,
text: text,
environment: environment
)
default:
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.

2 participants