Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Line Break #1237

Closed
benjaminBrownlee opened this issue Dec 1, 2017 · 6 comments
Closed

Enable Line Break #1237

benjaminBrownlee opened this issue Dec 1, 2017 · 6 comments

Comments

@benjaminBrownlee
Copy link

I personally hate horizontal scroll bars. I have read through many of the plugins and documentation but can't find a way to line-break in a manner that eliminates this. I can change the overflow property, but that compromises readability. Is there a way to add line-break?

@benjaminBrownlee benjaminBrownlee changed the title Enable Line break Enable Line Break Dec 1, 2017
@zeitgeist87
Copy link
Collaborator

You can use the Normalize-Whitespace plugin to break lines that are wider than a certain number of characters: http://prismjs.com/plugins/normalize-whitespace/

@Golmote
Copy link
Contributor

Golmote commented Mar 2, 2018

@benjaminBrownlee Or you could also set white-space: pre-wrap in CSS to enable line wrapping in your code blocks.

@Golmote Golmote closed this as completed Mar 2, 2018
@TheComputerM
Copy link

What if I want line breaks with indents?

@RunDevelopment
Copy link
Member

Unfortunately, CSS doesn't give us any easy tools to realize indented line wraps so we'd have to implement that ourselves which won't be easy.

So there's no easy solution right now. If you want to request this feature, please open a new issue.

@dpashkevich
Copy link

dpashkevich commented Mar 12, 2021

What about white-space: pre-wrap? Seems to do exactly what we need and it's fairly well supported today.

PS yes line wraps won't be indented this way but it's still much better than having a horizontal scroll on small viewports because there's e.g. a long comment line somewhere. Seems like a reasonable default behavior that's cheap to implement.

@TeoConan
Copy link

If you need to put a simple break line in your code you can also try this special char : 
&#10

image
<pre class='code language-shell' tabindex='0'>
    <code class='language-shell'>
        ~ which git&#13;&#10/usr/bin/git
    </code>
</pre>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants