19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Markdown用のリンクを作るブックマークレット

Last updated at Posted at 2013-06-08

Qiitaの記事を書いていてよく使うので残しておきます。

読みやすい版

javascript:(function() {
  prompt('Copy to clipboard',
    '[' + document.title.replace(/([\[\]])/g,'\\$1') + ']' + '(' + location.href + ')');
})();

一行版

javascript:(function(){prompt('Copy to Clipboard','['+document.title.replace(/([\[\]])/g,'\\$1')+']'+'('+location.href+')');})();

一応こだわった点としては、document.title.replace(/([\[\]])/g,'\\$1')として[]をエスケープしたところです。こうしないとタイトルに[]が含まれるページのリンクがおかしくなります。

まあ、こんなものでも意外と役に立つのでぜひ(既に自作してるかもしれませんが)

19
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?