27
20

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.

Github Wikiの印刷をキレイに

Last updated at Posted at 2015-02-21

GithubのWikiを印刷やPDFへ出力したりすると、ページヘッダやメニューバーなんかが一緒に印刷されてしまって生きるのが辛いですよね。

そんな時は、ブラウザのJavaScriptコンソールを開いて以下のコードを実行することで余計な要素を非表示にしてキレイに印刷することができます。

[
  "header",
  "pagehead",
  "gh-header-actions",
  "wiki-rightbar",
  "site-footer",
  "wiki-footer",
  "gh-header-meta"
].forEach(function (className) {
  document.getElementsByClassName(className)[0].style.display = 'none';
});

document.getElementsByClassName("has-rightbar")[0].classList.remove("has-rightbar")

// コードの右端が切れてしまうので改行させる
var codeTags = Array.from(document.getElementsByClassName("markdown-body")[0].getElementsByTagName("code"));
codeTags.forEach(function (e) {
  e.style["word-wrap"] = "break-word";
  e.style["white-space"] = "pre-wrap";
});
27
20
2

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
27
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?