clayh53 / tufte-jekyll

Minimal Jekyll blog styled to resemble the look and layout of Edward Tufte's books
MIT License
635 stars 206 forks source link

Lead-in space for code #64

Closed ekstroem closed 4 years ago

ekstroem commented 7 years ago

I've noticed a minor glitch that I cannot seem to track down. You can actually see it in the Jekyll-Tufte documentation here. If you look at the bottom towards the highlighted code (search for "module Jekyll") you can see that the indentation on the first line does not match the coding style. There are an additional 2 spaces (roughly) on the first line - and this indentation occurs on the first line of all code blocks.

The raw code looks ilke this:

``` ruby
module Jekyll
  class RenderFullWidthTag < Liquid::Tag
  require "shellwords"

    def initialize(tag_name, text, tokens)
      super
      @text = text.shellsplit
    end

    def render(context)
      "<div><img class='fullwidth' src='#{@text[0]}'/></div> " +
      "<p><span class='marginnote'>#{@text[1]}</span></p>"
    end
  end
end

Liquid::Template.register_tag('fullwidth', Jekyll::RenderFullWidthTag)


As you can see the first line, `module Jekyll` is perfectly left-aligned, but it isn't in the output. Does anyone have a clue as to where in the css files those two extra spaces have been inserted? 
ekstroem commented 7 years ago

Found out it is this bit from tufte.css that produces the problem

pre, pre code, p pre code { width: 52.5%;
           padding-left: 2.5%;
           overflow-x: auto; }

If the selectors pre code and p pre code are removed then it works. Not sure if it breaks anything tho'

adlersantos commented 6 years ago

I'm getting the same problem. This fixed it for me as well, thanks @ekstroem!

clayh53 commented 4 years ago

I have moved these two selectors from the tufte.scss file to a comment on the same line and yes, it does fix that weird format issue. I am not sure why the original tufte.css has these as selectors as it seems to be overly specific and not really needed.