-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
問題概要
埋め込みコード(<iframe>, <script>タグなど)内のURLに含まれる @ 記号が、Twitterユーザー名リンクに誤変換されてしまうことに気付きました。
再現手順
Mastodonの投稿の埋め込みコードを含むgfm記法の日記を書こうとします。
# subTitle
This is an embedding of a post of a Mathtodon server.
<iframe src="https://mathtod.online/@Nyoho/115394182617923497/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script src="https://mathtod.online/embed.js" async="async"></script>期待される動作
<iframe> タグの src 属性内のURLはそのまま書かれている。
実際の動作
@Nyoho の部分が次のようにTwitterリンクに変換されてしまう。
<iframe src="https://mathtod.online/@<a class="tweet-url username" href="https://twitter.com/Nyoho" rel="nofollow">Nyoho</a>/115394182617923497/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script src="https://mathtod.online/embed.js" async="async"></script>結果、src 属性が壊れて埋め込みが機能しなくなります。
原因
現在の実装では、<pre> と <code> タグはTwitter @ メンション変換処理の前にstashされているみたいですが、<iframe> や <script> などの埋め込みコード用のHTMLタグはstashされていません。そのため、iframe内のURLも変換されていると思われます。
Metadata
Metadata
Assignees
Labels
No labels