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.
- Host: GitHub
- URL: https://github.com/codingchili/github-markdown-pdf
- Owner: codingchili
- License: mit
- Created: 2020-04-12T11:37:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-12T12:00:48.000Z (almost 6 years ago)
- Last Synced: 2025-02-12T15:51:41.936Z (about 1 year ago)
- Topics: github, markdown, pdf, pdf-generation
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
```