mmistakes / minimal-mistakes

:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.
https://mmistakes.github.io/minimal-mistakes/
MIT License
12.42k stars 25.6k forks source link

width of code block (<code></code> tags width size in article) #1496

Closed zooozoo closed 6 years ago

zooozoo commented 6 years ago

Environment informations


In the single layout page, code block html tags structure is

<div class="highlighter-rouge-">
  <div class="highlight">
    <pre class="highlight">
      <code></code>
    </pre>
  </div>
</div>

Directly I want to break line if the code block content is too long.

Currenttly if the content of the code block has a long line, we can use scroll bar of the bottom of the code block. And what I want to do is just break the long line automatically instead of using scroll bar.

I thought it is reason that the I have 'toc nav' and <code> tag width is wider than wrapper tags. And If I could resizing the width, i could make it. But I f failed to resizing width of the <code>tag. I don't know how can do that.

Any recommands... are good for me!

Thanks

mmistakes commented 6 years ago

This is simple CSS and can be done with the white-space declaration.

pre {
  white-space: pre-wrap;
}

Will turn codeblocks like this:

image

Into this (scroll bar goes away and lines are wrapped):

image

zooozoo commented 6 years ago

Great~! Thanks!!