Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Grav-plugin-prism-highlight - Line wrapping?

Started by Michael Schapira 5 years ago · 4 replies · 1109 views
5 years ago

Thanks @spamhater -

I changed path/user/plugins/prism-highlight/css/prism.css and modified

CSS
code[class*="language-"],
pre[class*="language-"] {
    color: black;
    background: none;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 1em;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-break: normal;
    /* word-wrap: normal; */
    word-wrap: break-word !important;
    line-height: 1.5;

    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;

    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

I checked browser dev tool and it comes back properly, but doesn't change it on the screen.
Some other file must be taking precedence.

Any idea which one?

5 years ago

is the site live ? can I look at the page your looking at and see what you are visual trying to accomplish please.

TXT
https://github.com/PrismJS/prism/issues/1237

Is it frontend or backend the issue occurs ? 

maybe to force the css to overwrite be a priority use the !important 

so based on your code provided 

TXT
code[class*="language-"], pre[class*="language-"]  !important; { 
white-space: normal !important;
word-break: break-word !important;

}

https://twig-extensions.readthedocs.io/en/latest/text.html#installation

https://github.com/Perlkonig/grav-plugin-twig-extensions

https://www.perlkonig.com/demos/twig-extensions

Or if you are using twig and wanting to alter the display

'https://twig.symfony.com/doc/1.x/filters/split.html'

Sorry all this is looking at a problem whilst blind, there is no real visualization or what / how you are expecting it to work. Maybe do a screen capture or screen video of the issue and what you are expecting.

Maybe with more info and what you are trying to replicate, I can try and recreate it and see what possibilities there are. With prism seeming to in reduced support and conflicts on some of the updates, it may not be possible.

:)

TXT

last edited 06/18/21 by Spam Hater
5 years ago

@antineutrinos

To test a solution to fix line-wrapping in prism, I'm using a PHP code snippet leading to the following result:
sol0|475x142

When Googling on "prism line wrap":

Note:

  • By the way, this hasn't got much to do with Prism, but with <pre> and <code>in general. Using white-space: pre-wrap will make these wrap.
  • Please be advised that adding code the plugin itself isn't a very good idea. When a new version of the plugin is released and installed, all changes will be lost.
last edited 06/19/21 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 95 14 hours ago
General · by pamtbaau, 20 hours ago
1 61 19 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 356 5 days ago
General · by Duc , 6 days ago
3 44 6 days ago