badlydrawnrob / print-first-css

0 stars 0 forks source link

Pre blocks generally don't stack together #41

Open badlydrawnrob opened 7 months ago

badlydrawnrob commented 7 months ago

Is it necessary to prevent a gap if two code blocks are siblings?

Pandoc spews out default css code in the header when compiling the template. Removing margin: 1em 0 from .sourceCode will stack them together — but this shouldn't be needed — custom Skylighting css should be the default (not Pandocs template code).

Screenshot 2023-11-30 at 18 34 36

Wasted code?

I think originally I added this because of the Anki Themes layout.

  • div wrappers have no padding or margins
  • pre tags have padding only (no margins)

Two code blocks in Anki Themes will stack together with no gaps.

Screenshot 2023-11-30 at 18 29 06

The following code.less is using negative margin-top:

  & + & {
    border-top: transparent;
    margin-top: calc(var(--spacing) * -1);  // #2
  }

I expect my thinking was to make sure that two pre blocks together would stack up without a gap ... only, while using Pandoc the <div class="sourceCode"> for Skylighting the pre blocks are never going to be right next to each other!

div.sourceCode {
  margin: 1em 0;
}

The above code is what Skylighting wrapper will do; two pre blocks rendered with Pandoc will produce a gap.