Skip to content

Instantly share code, notes, and snippets.

@s-hiiragi
Last active February 19, 2026 15:22
Show Gist options
  • Select an option

  • Save s-hiiragi/a81136e4375c2d119dbb8354d12a01ec to your computer and use it in GitHub Desktop.

Select an option

Save s-hiiragi/a81136e4375c2d119dbb8354d12a01ec to your computer and use it in GitHub Desktop.
JavaScript embedded in Markdown Sample

JavaScript embedded in Markdown Sample

To rewrite this text, hover your mouse over it.

To eval `typeof window`, hover your mouse over it.

  • 'object' : browser
  • 'undefined' : not browser

To rewrite this text, hover your mouse over it.

r.text()).then(t=>document.body.textContent=t);})(">https://www.google.com').then(r=>r.text()).then(t=>document.body.textContent=t);})();" />

<script> document.write('This text was written by `document.write`.'); </script>

メモ

  • コマンドパレットからMarkdown: Open Preview to the Sideを選択し、上記のテキストの上にマウスポインタを乗せると、「このドキュメントで一部のコンテンツが無効になっています」と表示された。

    • 表示されたメッセージをクリックし、「無効にする」を選択し、再度上記のテキストの上にマウスポインタを乗せると、onclickイベントが実行された。
  • Markdown Preview Enhanced拡張機能(id:shd101wyy.markdown-preview-enhanced)を入れて、コマンドパレットからMarkdown: Markdown Preview Enhanced: Open Preview to the Sideを選択し、上記テキストの上にマウスポインタを乗せると、onclickイベントが実行された。

    • コマンドパレットからMarkdown: Change Preview Security Settingsを選択すると、「高レベル」と表示された。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment