Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ckreon
Copy link

@ckreon ckreon commented Apr 11, 2016

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.

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.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 87.671% when pulling e2412ea on ckreon:patch-2 into 05985b3 on alanshaw:master.

@alanshaw
Copy link
Owner

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 baseStyle option that by default is "ghm" but can be set to "html5bp", users can then use the cssPath option to override the base styles to customise.

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?

@ckreon
Copy link
Author

ckreon commented Feb 20, 2017

@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.

@dydFreeman
Copy link

So, how is it going with this merge request? Are we going to have the Github style as default? :)

@roccomuso
Copy link

roccomuso commented Jun 5, 2017

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;

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@LinusU
Copy link

LinusU commented Apr 18, 2018

I would absolutely love to see this as the default as well!

margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
white-space: pre;
white-space: pre-wrap;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants