mmistakes / jekyll-theme-skinny-bones

A Jekyll starter with a variety of flexible layouts and components.
https://mmistakes.github.io/jekyll-theme-skinny-bones
MIT License
802 stars 907 forks source link

<code> blocks are placed on one line. #11

Closed onato closed 9 years ago

onato commented 9 years ago

Using the following in _base.scss causes lines of code to be put all on one line…

p code,
…
  white-space: nowrap;
mmistakes commented 9 years ago

That bit of CSS is intentional. Sometimes you want highlighted code inline and the nowrap is necessary for that to work. The common way of displaying a larger block of code with multiple lines is to wrap <code></code> with <pre>.

I just added a demo syntax highlighting post showing all the ways you can add code to your Jekyll posts.

Personally I never write the HTML to do that manually and instead let MarkDown do the dirty work. But if that's what you're doing you'll want it to look something like this:

<pre>
    <code>
       // your code goes here
    </code>
</pre>