moin icon indicating copy to clipboard operation
moin copied to clipboard

Preformatted text may wrap at any place.

Open gmilde opened this issue 2 months ago • 0 comments

common.css contains the settings:

white-space: pre-wrap; 
word-wrap: break-word; 
word-break: break-all;

in the rules for both, .code and pre. This mimics the behaviour of an x-terminal or console.

  • This may be suited for an IRC log (wiki.local:help-en/OtherTextItems#IRC_Log).
  • It is problematic for source code in a language with "semantic indentation" like Python or reStructuredText (wiki.local:help-en/OtherTextItems#Python)
  • It is fatal to ASCII art, e.g., the documentation of "grid tables" for the rST converter. (wiki.local:help-en/rst#Grid_Tables)

The settings for .code also include a padding and frame that looks strange and leads to overlap and obstructuion when inline code is wrapped (wiki.local:help-en/rst#Text_formatting).

Suggestion:

  • Use white-space: pre and overflow: auto for both, pre.code and pre.
  • Define a new user style .wrap that can be applied to, e.g., a full-width IRC Log. Different rules for wrap and pre.wrap could care for different handling of normal vs. pre-formatted text. (Consider using overflow-wrap instead of the legacy alias word-break.)
  • Use a different style for code blocks (pre.code) and inline code (code, .code) with less padding and no frame for inline code.

gmilde avatar Dec 09 '25 15:12 gmilde