Help us understand the problem. What is going on with this article?

Qiitaで、記事ソース(Markdown)を抽出するブックマークレットを作成しました

More than 3 years have passed since last update.

概要

 タイトルの通りです。確認するためだけにわざわざ編集ボタンを押すなんてバカバカしいので……。

作成したブツはこちら

qiita_mark.js
javascript : (function ()
{
    var str = document.getElementById('raw_body').value;
    var obj = window.open();
    obj.document.open();
    obj.document.write(str);
    obj.document.close();
})();

修正案

 ただ、上記のコードでは、Markdown部分の改行がHTML側で認識されず、横にベタッとなったページになってしまいます。
 その辺りを改善したtadsanさん版を貼っておきます。

qiita_mark2.js
javascript:(function ()
{
    var str = document.getElementById('raw_body').value;
    var obj = window.open();
    obj.document.open();
    obj.document.write("<pre><code>");
    obj.document.write(str);
    obj.document.close();
})();
YSRKEN
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした