Prism: Enable Line Break

Created on 1 Dec 2017  路  4Comments  路  Source: PrismJS/prism

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?

Most helpful comment

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

All 4 comments

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/

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

What if I want line breaks with indents?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sheljohn picture sheljohn  路  4Comments

neginbasiri picture neginbasiri  路  8Comments

nterray picture nterray  路  4Comments

kizu picture kizu  路  7Comments

apollolux picture apollolux  路  4Comments