public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Adding minimal CSS to pandoc's default HTML template
@ 2020-08-22 11:23 mb21
       [not found] ` <41422a08-cc8d-4480-8bfc-03d907cb2794n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: mb21 @ 2020-08-22 11:23 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1641 bytes --]

We're looking for feedback on a pull request I made: it adds some minimal 
CSS to pandoc's default HTML template.

Two things that inspired this:

- questions like this one on StackOverflow: 
https://stackoverflow.com/questions/63293929/pandoc-change-font-family-to-sans-while-converting-from-markdown-to-html
- 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.

The new CSS is added by default when using the `--standalone` option, 
unless you also use the `--css` option or convert to slideshows. Inclusion 
can be disabled e.g. with `pandoc -M document-css=false`. Or customized 
(like all templates and template partials) by adding your own file to 
~/.pandoc/templates/styles.html.

There are a few variables like `mainfont`, `fontsize` etc. that you can 
set, similar to what we already have in the LaTeX template. Have a look at 
the proposed changes to the MANUAL (and to styles.html):

https://github.com/jgm/pandoc/pull/6601/files

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/41422a08-cc8d-4480-8bfc-03d907cb2794n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2070 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found] ` <41422a08-cc8d-4480-8bfc-03d907cb2794n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-08-23 11:54   ` Albert Krewinkel
       [not found]     ` <87r1rxa887.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Albert Krewinkel @ 2020-08-23 11:54 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Looks great, IMHO! The produced layout is beautiful, and
supporting more variables is nice, too.

The only concern I have is that this could open pandora's box when
is comes to requests for CSS tweaks. But this seems like a minor
problem.


mb21 writes:

> We're looking for feedback on a pull request I made: it adds some minimal
> CSS to pandoc's default HTML template.
>
> Two things that inspired this:
>
> - questions like this one on StackOverflow:
> https://stackoverflow.com/questions/63293929/pandoc-change-font-family-to-sans-while-converting-from-markdown-to-html
> - 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.
>
> The new CSS is added by default when using the `--standalone` option,
> unless you also use the `--css` option or convert to slideshows. Inclusion
> can be disabled e.g. with `pandoc -M document-css=false`. Or customized
> (like all templates and template partials) by adding your own file to
> ~/.pandoc/templates/styles.html.
>
> There are a few variables like `mainfont`, `fontsize` etc. that you can
> set, similar to what we already have in the LaTeX template. Have a look at
> the proposed changes to the MANUAL (and to styles.html):
>
> https://github.com/jgm/pandoc/pull/6601/files


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]     ` <87r1rxa887.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2020-08-23 17:24       ` mb21
  2020-08-24 17:51       ` Daniel Staal
  1 sibling, 0 replies; 8+ messages in thread
From: mb21 @ 2020-08-23 17:24 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2514 bytes --]

Thanks!


Yeah, I suppose we'll have to strike a balance in accommodating requests 
for layout tweaks, just like we do for the LaTeX template. Although 
additional CSS, which would potentially override the default one, can 
easily be added, e.g. with:

--- 
header-includes: | 
  <style> 
  td { 
    border: 1px solid grey; 
  } 
  </style> 
---


On Sunday, August 23, 2020 at 1:54:11 PM UTC+2 Albert Krewinkel wrote:

> Looks great, IMHO! The produced layout is beautiful, and
> supporting more variables is nice, too.
>
> The only concern I have is that this could open pandora's box when
> is comes to requests for CSS tweaks. But this seems like a minor
> problem.
>
>
> mb21 writes:
>
> > We're looking for feedback on a pull request I made: it adds some minimal
> > CSS to pandoc's default HTML template.
> >
> > Two things that inspired this:
> >
> > - questions like this one on StackOverflow:
> > 
> https://stackoverflow.com/questions/63293929/pandoc-change-font-family-to-sans-while-converting-from-markdown-to-html
> > - 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.
> >
> > The new CSS is added by default when using the `--standalone` option,
> > unless you also use the `--css` option or convert to slideshows. 
> Inclusion
> > can be disabled e.g. with `pandoc -M document-css=false`. Or customized
> > (like all templates and template partials) by adding your own file to
> > ~/.pandoc/templates/styles.html.
> >
> > There are a few variables like `mainfont`, `fontsize` etc. that you can
> > set, similar to what we already have in the LaTeX template. Have a look 
> at
> > the proposed changes to the MANUAL (and to styles.html):
> >
> > https://github.com/jgm/pandoc/pull/6601/files
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/870bb19a-a503-4041-a1b3-1f32df467020n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4062 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]     ` <87r1rxa887.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2020-08-23 17:24       ` mb21
@ 2020-08-24 17:51       ` Daniel Staal
       [not found]         ` <c26ebc5e-35e3-0e84-037e-d8fa1f119438-Jdbf3xiKgS8@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Staal @ 2020-08-24 17:51 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 8/23/20 7:54 AM, Albert Krewinkel wrote:
> Looks great, IMHO! The produced layout is beautiful, and
> supporting more variables is nice, too.
> 
> The only concern I have is that this could open pandora's box when
> is comes to requests for CSS tweaks. But this seems like a minor
> problem.

It's also worth considering that not all HTML output is fed to a 
browser.  I've used Pandoc to feed to local previews, or to sites that 
can ingest HTML and work with it.  It's probably embedded into some 
pipelines someplace as well.

I appreciate the thought on this, but I'm not sure it's something we 
want on by default - and it's also something that can be implemented 
fairly easily by the user editing their default template.

Daniel T. Staal

-- 
---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]         ` <c26ebc5e-35e3-0e84-037e-d8fa1f119438-Jdbf3xiKgS8@public.gmane.org>
@ 2020-08-24 18:42           ` mb21
  2020-08-24 20:03           ` John MacFarlane
  1 sibling, 0 replies; 8+ messages in thread
From: mb21 @ 2020-08-24 18:42 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2101 bytes --]

That was my instinctive reaction at first as well, but I cannot imagine a 
case where you would use --selfcontained and not also want some CSS.

- for local preview, it's a plus if it looks good, right?
- if it's fed to a website, you're probably not using --standalone, since 
the site generator or whatever does that part..?


On Monday, August 24, 2020 at 7:51:17 PM UTC+2 DSt...-Jdbf3xiKgS8@public.gmane.org wrote:

> On 8/23/20 7:54 AM, Albert Krewinkel wrote: 
> > Looks great, IMHO! The produced layout is beautiful, and 
> > supporting more variables is nice, too. 
> > 
> > The only concern I have is that this could open pandora's box when 
> > is comes to requests for CSS tweaks. But this seems like a minor 
> > problem. 
>
> It's also worth considering that not all HTML output is fed to a 
> browser. I've used Pandoc to feed to local previews, or to sites that 
> can ingest HTML and work with it. It's probably embedded into some 
> pipelines someplace as well. 
>
> I appreciate the thought on this, but I'm not sure it's something we 
> want on by default - and it's also something that can be implemented 
> fairly easily by the user editing their default template. 
>
> Daniel T. Staal 
>
> -- 
> --------------------------------------------------------------- 
> This email copyright the author. Unless otherwise noted, you 
> are expressly allowed to retransmit, quote, or otherwise use 
> the contents for non-commercial purposes. This copyright will 
> expire 5 years after the author's death, or in 30 years, 
> whichever is longer, unless such a period is in excess of 
> local copyright law. 
> --------------------------------------------------------------- 
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8c5e8a72-f74f-4a8b-b6c4-7b79d895c614n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2747 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]         ` <c26ebc5e-35e3-0e84-037e-d8fa1f119438-Jdbf3xiKgS8@public.gmane.org>
  2020-08-24 18:42           ` mb21
@ 2020-08-24 20:03           ` John MacFarlane
       [not found]             ` <m2v9h7x13x.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2020-08-24 20:03 UTC (permalink / raw)
  To: Daniel Staal, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Daniel Staal <DStaal-Jdbf3xiKgS8@public.gmane.org> writes:

>> The only concern I have is that this could open pandora's box when
>> is comes to requests for CSS tweaks. But this seems like a minor
>> problem.
>
> It's also worth considering that not all HTML output is fed to a 
> browser.  I've used Pandoc to feed to local previews, or to sites that 
> can ingest HTML and work with it.  It's probably embedded into some 
> pipelines someplace as well.

You can always use "fragment" mode if that's what you want (no -s).
The CSS will not be embedded in this case.

For local previews, though, won't it be better with the CSS,
which gives you a sane margin, fonts, etc.?

> I appreciate the thought on this, but I'm not sure it's something we 
> want on by default - and it's also something that can be implemented 
> fairly easily by the user editing their default template.

True, but if this is an argument against it, wouldn't it be an
argument against *everything* in the default template?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]             ` <m2v9h7x13x.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2020-08-29 10:06               ` Ganriel Nützi
       [not found]                 ` <6497A421-E81B-45BA-8148-47B9CFC94C78-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Ganriel Nützi @ 2020-08-29 10:06 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

It would definitely be a good idea to support a minimal css such that the document is somewhat sane. but anyway where does it stop, like Albert said it opens the box for requests like „oh can we add this or that“ to the minimal set :) However is the current impl. such that the minimal css (document-css) does not get added if we use a custom css style etc. Because converting an older document will result then in a minimal css +  custom css? 

is there not room for an external solution: a repo with pandoc css styles which can be used and which is referred to in the doc? 

BR Gabriel



Von meinem iPhone gesendet

> Am 24.08.2020 um 22:03 schrieb John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:
> 
> Daniel Staal <DStaal-Jdbf3xiKgS8@public.gmane.org> writes:
> 
>>> The only concern I have is that this could open pandora's box when
>>> is comes to requests for CSS tweaks. But this seems like a minor
>>> problem.
>> 
>> It's also worth considering that not all HTML output is fed to a 
>> browser.  I've used Pandoc to feed to local previews, or to sites that 
>> can ingest HTML and work with it.  It's probably embedded into some 
>> pipelines someplace as well.
> 
> You can always use "fragment" mode if that's what you want (no -s).
> The CSS will not be embedded in this case.
> 
> For local previews, though, won't it be better with the CSS,
> which gives you a sane margin, fonts, etc.?
> 
>> I appreciate the thought on this, but I'm not sure it's something we 
>> want on by default - and it's also something that can be implemented 
>> fairly easily by the user editing their default template.
> 
> True, but if this is an argument against it, wouldn't it be an
> argument against *everything* in the default template?
> 
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2v9h7x13x.fsf%40johnmacfarlane.net.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6497A421-E81B-45BA-8148-47B9CFC94C78%40gmail.com.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding minimal CSS to pandoc's default HTML template
       [not found]                 ` <6497A421-E81B-45BA-8148-47B9CFC94C78-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2020-08-29 12:52                   ` BPJ
  0 siblings, 0 replies; 8+ messages in thread
From: BPJ @ 2020-08-29 12:52 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 3766 bytes --]

> However is the current impl. such that the minimal css (document-css)
does not get added if we use a custom css style etc. Because converting an
older document will result then in a minimal css +  custom css?

Yes apparently the default minimal CSS will not be added if the `$css$`
variable is defined/true. However a `nocss` variable might be in order so
that you don't end up with empty/malformed style/link elements in case you
truly don't want *any* CSS.


-- 
Better --help|less than helpless

Den lör 29 aug. 2020 12:07Ganriel Nützi <gnuetzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> It would definitely be a good idea to support a minimal css such that the
> document is somewhat sane. but anyway where does it stop, like Albert said
> it opens the box for requests like „oh can we add this or that“ to the
> minimal set :) However is the current impl. such that the minimal css
> (document-css) does not get added if we use a custom css style etc. Because
> converting an older document will result then in a minimal css +  custom
> css?
>
> is there not room for an external solution: a repo with pandoc css styles
> which can be used and which is referred to in the doc?
>
> BR Gabriel
>
>
>
> Von meinem iPhone gesendet
>
> > Am 24.08.2020 um 22:03 schrieb John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:
> >
> > Daniel Staal <DStaal-Jdbf3xiKgS8@public.gmane.org> writes:
> >
> >>> The only concern I have is that this could open pandora's box when
> >>> is comes to requests for CSS tweaks. But this seems like a minor
> >>> problem.
> >>
> >> It's also worth considering that not all HTML output is fed to a
> >> browser.  I've used Pandoc to feed to local previews, or to sites that
> >> can ingest HTML and work with it.  It's probably embedded into some
> >> pipelines someplace as well.
> >
> > You can always use "fragment" mode if that's what you want (no -s).
> > The CSS will not be embedded in this case.
> >
> > For local previews, though, won't it be better with the CSS,
> > which gives you a sane margin, fonts, etc.?
> >
> >> I appreciate the thought on this, but I'm not sure it's something we
> >> want on by default - and it's also something that can be implemented
> >> fairly easily by the user editing their default template.
> >
> > True, but if this is an argument against it, wouldn't it be an
> > argument against *everything* in the default template?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/m2v9h7x13x.fsf%40johnmacfarlane.net
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/6497A421-E81B-45BA-8148-47B9CFC94C78%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDJ6NfpeeEDzkeUc%3DLtTShsCL93vPjZdOQ-qkLdxpc2Hg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 5428 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-29 12:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 11:23 Adding minimal CSS to pandoc's default HTML template mb21
     [not found] ` <41422a08-cc8d-4480-8bfc-03d907cb2794n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-08-23 11:54   ` Albert Krewinkel
     [not found]     ` <87r1rxa887.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-08-23 17:24       ` mb21
2020-08-24 17:51       ` Daniel Staal
     [not found]         ` <c26ebc5e-35e3-0e84-037e-d8fa1f119438-Jdbf3xiKgS8@public.gmane.org>
2020-08-24 18:42           ` mb21
2020-08-24 20:03           ` John MacFarlane
     [not found]             ` <m2v9h7x13x.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-08-29 10:06               ` Ganriel Nützi
     [not found]                 ` <6497A421-E81B-45BA-8148-47B9CFC94C78-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-08-29 12:52                   ` BPJ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).