Skip to content

swift/ax_text: include image alt text in browser capture#32

Closed
moeki0 wants to merge 1 commit into
mainfrom
ax-text-alt
Closed

swift/ax_text: include image alt text in browser capture#32
moeki0 wants to merge 1 commit into
mainfrom
ax-text-alt

Conversation

@moeki0

@moeki0 moeki0 commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Problem

Cosense のアイコン記法 [name.icon]<img alt="name"> としてレンダリングされる。
従来の document.body.innerText は alt を拾わないため、tunr の screen capture では
by [Claude Code.icon] のような行が by と空白に化けていた(tunrのHobbyチャンネルで観測)。

Fix

document.body.innerText を取る前に body の clone を作り、img[alt][alt] という
テキストノードに置換してから innerText を読む。これで alt がドキュメント順で本文に流れ込む。

Test plan

  • swiftc でビルド
  • 手元の tunr-ax-text で Cosense ページを叩き、[Claude Code] のようなアイコン名が捕捉されることを確認
  • brew formula 更新前にローカル engine で動作確認

🤖 Generated with Claude Code

Cosense's icon notation (e.g. [Claude Code.icon]) renders as <img alt="Claude Code">,
which document.body.innerText silently skips. Replaces each img[alt] with a text node
containing " [alt] " before reading innerText, so alt text now flows into capture in
document order.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@moeki0 moeki0 closed this Apr 29, 2026
@moeki0 moeki0 deleted the ax-text-alt branch April 29, 2026 00:26
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