How to print from GitHub

前端 未结 20 1389
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 20:17

If I want to print a markdown file from GitHub as it appears on screen, for example: https://github.com/RestKit/RestKit/blob/master/Docs/Object%20Mapping.md

Then how can

20条回答
  •  长发绾君心
    2021-01-29 20:31

    Works for Chromium browsers and "current" GitHub html page structure

    1. Create a bookmark
    2. In the Address field enter :
    javascript:var content = document.querySelector('.repository-content'); 
    var toc = document.querySelector('#wiki-rightbar');
    toc.innerHTML = '';
    var wb = document.querySelector('.has-rightbar .wiki-body');
    wb.style.marginRight = '0px';
    var body = document.querySelector('body'); 
    body.innerHTML = ''; 
    body.appendChild(content);
    window.print();
    

    Selects the Wiki text, removes and formats the table of content, replaces the body content and calls the printer.

提交回复
热议问题