Skip to content

Port upstream reference linked image click fix#74

Open
Renakoni wants to merge 1 commit into
sync/upstream-4858-linked-image-modifier-clickfrom
sync/upstream-4866-reference-raw-linked-images
Open

Port upstream reference linked image click fix#74
Renakoni wants to merge 1 commit into
sync/upstream-4858-linked-image-modifier-clickfrom
sync/upstream-4866-reference-raw-linked-images

Conversation

@Renakoni

@Renakoni Renakoni commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Upstream

Ports marktext/marktext#4866: marktext/marktext#4866

This is stacked on #73 (sync/upstream-4858-linked-image-modifier-click) because upstream #4866 depends on #4858's exported LINK_SELECTOR, linked-image modifier-click guard, and linked-image regression test.

Android relevance

Android carries the same Muya inline tokenizer, image renderer, CSS, and image/link click handlers. Reference-linked README badges ([![alt](img)][ref]) and raw-HTML linked images can appear in Markdown edited on Android, so the same rendering and event behavior applies in the WebView editor.

Changes

  • Allow reference_link tokenization to capture image link text, so [![alt](img)][ref] becomes one reference link wrapping the image instead of a bare image plus fragmented reference link.
  • Render inline-image hover controls as span instead of nested a elements, preventing invalid <a> inside <a> markup when an image is inside a real reference/raw-HTML anchor.
  • Relax the image icon CSS selectors from a.mu-image-icon-* to .mu-image-icon-* to match the new span controls.
  • Extend linked image click coverage for reference-linked images.
  • Add tokenizer coverage for image reference-link anchors.
  • Add jsdom coverage for raw-HTML linked images, where the real anchor nesting behavior is observable.

Verification

  • pnpm --dir third_party/muya exec vitest run src/inlineRenderer/__tests__/referenceLinkImageAnchor.spec.ts src/selection/__tests__/linkedImageClick.spec.ts src/selection/__tests__/rawHtmlLinkedImageClick.spec.ts
  • pnpm build

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