New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Github-like Styling as a default option #91
base: master
Are you sure you want to change the base?
Conversation
This is a modified version of the [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) stylesheet, made to work with markdown-pdf. It should be an optional feature, as it doesn't interfere with the default styling, but if turned on makes a very nice looking PDF. Inspired by issue alanshaw#52.
Thanks for your work on this and sorry for not reviewing it sooner. I think it might be worth considering this as the default CSS, and relegating html5bp CSS as an option (to retain backwards compatibility). The html5bp styles are great, but perhaps a little too basic. It has nothing to say about rendering tables for example - they simply have no borders and are a commonly used element. It causes issues like #111 I'd like to see a Finally, what bits of github-markdown-css did you modify? Would it be possible to depend on that module directly and simply override the CSS where appropriate? @ckreon what do you reckon? |
@alanshaw I used a previous version of the github-markdown-css, and modified the file to work with a standard layout. It was an easy fix (just stripping prefixes), but would require some automation to depend on externally. That said, the github-markdown-css project aims to align with Github's styling, and that got ugly for non-Github stuff when they switched to system fonts. That was a really ugly change that ruined layout/proportions (as system fonts tend render larger by default), and was only a portion of what got worse. I use an older version of the CSS (the one submitted with this pull request, actually), as it is the best looking and most compatible variant I've used. I don't think you could go wrong making it the default option - PDF's look much nicer, and as you mentioned, it adds table support, block quotes, etc. Adding the html5bp as an option provides a graceful fallback if needed, and might be nice to use with fully custom styles, as it is less defined. Let me know your thoughts - I'm happy to close this and just let you strip the CSS out if needed. |
So, how is it going with this merge request? Are we going to have the Github style as default? :) |
I'd be glad to have it too. Thanks! PS. there's a bug (there's no line-break when you have a long line in a snippet of code). |
margin: 0; | ||
font-size: 100%; | ||
word-break: normal; | ||
white-space: pre; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed to pre-wrap
and PR could be merged after that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I would absolutely love to see this as the default as well! |
margin: 0; | ||
font-size: 100%; | ||
word-break: normal; | ||
white-space: pre; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
white-space: pre; | |
white-space: pre-wrap; |
This is a modified version of the github-markdown-css stylesheet, made to work with markdown-pdf. It should be an optional feature, as it doesn't interfere with the default styling, but if turned on makes a very nice looking PDF.
Inspired by issue #52.