swift/ax_text: include image alt + src in browser capture#33
Merged
Conversation
document.body.innerText silently drops <img> nodes, so Cosense's icon notation [name.icon] (rendered as <img alt="name" src="...">) was captured as a blank space. Replace each <img> with a text node containing "alt src" (whichever exist) on a body clone before reading innerText, so both the human-readable label and the resource URL flow into the captured text in document order. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cosenseのアイコン記法
[name.icon]は<img alt="name" src="...">でレンダリングされる。document.body.innerTextは<img>を黙って飛ばすため、tunr の screen capture でby [Claude Code.icon]がbyと空白に化けていた(Hobbyチャンネル経由で観測)。Fix
body の clone を作り、
<img>を「alt と src を半角スペースで連結したテキストノード」に置換してからinnerTextを取る。これでアイコンの人間可読ラベルと画像URLの両方がドキュメント順で本文に流れ込む。Sanity review notes
[name]形式(ブラケット囲み)は Cosense の[link]記法と衝突するため採用せず、ラベルそのまま挿入substring(0, 5000)が UTF-16 単位なので、長い src URL を持つ画像が大量にあると本文が押し出される。当面は実害が小さいので許容\|\|\|ENDなどの AppleScript デリミタが alt/src 値に混入するとパース破壊の理論的可能性あり(既存問題の延長)。別タスクで JSON 化検討Test plan
[Claude Code][Moeki Kawakami]等が捕捉されることを確認tunr-ax-text --allで alt + src 両方出力されることを確認(例:Moeki Kawakami https://gyazo.com/.../max_size/400)🤖 Generated with Claude Code