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 CSS to default HTML template #6601

Merged
merged 1 commit into from
Sep 19, 2020
Merged

Add CSS to default HTML template #6601

merged 1 commit into from
Sep 19, 2020

Conversation

mb21
Copy link
Collaborator

@mb21 mb21 commented Aug 8, 2020

Two things that inspired this:

  • questions like this one on StackOverflow
  • I've recently updated and streamlined the CSS I use to generate simple HTML files (or publish to my blog), and was surprised how minimal it can be, while still looking pretty good (IMHO). The idea is to rely on browser defaults as much as possible (which are fairly consistent nowadays), so you don't have to override/normalize a lot.

Maybe this has been discussed before, but what about including something like this in the default HTML template?

I also quickly looked into moving this into the styles.html partial, but there we don't have access to all those variables I assume?

TODO:

  • update the MANUAL, only new variable names are fontcolor, backgroundcolor (and style), although I suppose we could add a few more... considering how many we have for the LaTeX template... to allow even more customizations out of the box.
  • add a variable to disable outputting that whole CSS block? Perhaps we could also set that variable automatically when --css was used? But I cannot imagine any scenario where you'd use --standalone, but wouldn't want any CSS whatsoever.

@mb21 mb21 force-pushed the html-template branch 2 times, most recently from 2f9b5ca to 2adde29 Compare August 9, 2020 10:13
data/templates/default.html5 Outdated Show resolved Hide resolved
@mb21 mb21 force-pushed the html-template branch 3 times, most recently from ab72641 to b84f8b2 Compare August 9, 2020 15:30
@jgm
Copy link
Owner

jgm commented Aug 9, 2020

I'd have to think more about this, it's an interesting idea.

Note: the styles partial should have access to the same variables.

@mb21 mb21 force-pushed the html-template branch 2 times, most recently from 26d87d1 to 6317352 Compare August 15, 2020 09:50
@mb21 mb21 marked this pull request as ready for review August 15, 2020 09:51
@mb21 mb21 force-pushed the html-template branch 3 times, most recently from 18d262d to 35b05b5 Compare August 15, 2020 10:57
data/templates/default.html5 Outdated Show resolved Hide resolved
MANUAL.txt Outdated Show resolved Hide resolved
@mb21 mb21 force-pushed the html-template branch 3 times, most recently from 2e52661 to 85d96b6 Compare August 19, 2020 09:26
@jgm
Copy link
Owner

jgm commented Aug 21, 2020

I have now tried this. The output is beautiful, and it adapts well to smaller screens.
I think a change like this should be discussed on pandoc-discuss. Do you want to start a topic there, so people can weigh in?

@mb21
Copy link
Collaborator Author

mb21 commented Aug 22, 2020

Thanks, will do!

@jgm jgm merged commit caa225a into jgm:master Sep 19, 2020
@jgm
Copy link
Owner

jgm commented Sep 20, 2020

I decided to merge this; comments were favorable. It was mentioned that this might give rise to endless requests for tweaks in the styling -- that is a danger, but we'll see!

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.

2 participants