How to avoid line breaks inside the `->` operator in `<code>` blocks?

I have a large HTML document containing C ++ inline <code>sequences such as foo->bar. Since hyphens are often used to induce line breaks, this sometimes leads to the conclusion, for example:

blah blah foo-
>barblah blah

which is undesirable.

  • Replacing -(U + 002D) with (U + 2011; inextricable hyphen) is unacceptable because it splits the search ->in shared browsers.
  • Style elements <code>with are white-space:nowrapundesirable because some segments of inline code are long enough for them to really turn around.
  • The manual style of each statement ->with <span style="white-space:nowrap">(or <nobr>) is unacceptable due to the editorial load, but you can write a script for this.

Is there a declarative way to indicate that inside is ->not a good place for line breaks?

(This question is not really a duplicate. How can I use CSS to save line breaks in an HTML <code> block : this question asks how to avoid line breaks, while this question asks how they create.)

+4
source share
1 answer

css . , , - ( @hyphenate-resource) , ...

script, : script

, , crossbrowser

+1

Source: https://habr.com/ru/post/1543700/


All Articles