An open API service indexing awesome lists of open source software.

https://github.com/codingchili/github-markdown-pdf

Sometimes you're too lazy to get it right with pandoc.
https://github.com/codingchili/github-markdown-pdf

github markdown pdf pdf-generation

Last synced: 12 months ago
JSON representation

Sometimes you're too lazy to get it right with pandoc.

Awesome Lists containing this project

README

          

# github-markdown-pdf
Sometimes you're too lazy to get it right with pandoc.

This tiny script makes it possible to render markdown hosted on GitHub to pdf using the browser.

1) view a **markdown** file on github.
2) press alt+shift+I and open the chrome console.
3) paste the following snippet and print (save) to pdf.

```javascript
let markdown = document.getElementById('readme');

// remove the box-header if in file reader
if (markdown.firstElementChild.tagName === 'DIV') {
markdown.removeChild(markdown.firstElementChild)
}
document.body.innerHTML = markdown.innerHTML;

let style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
@page {
margin: 0;
}

img {
/* custom style for your images. */
}

body {
padding: 24px;
}

`;
document.getElementsByTagName('head')[0].appendChild(style);
print();
location.reload();
```