It would be great if the codefilter.module could preserve whitespace similar to how <pre> tags preserve whitespace. By not preserving whitespace, it removes any indentation in the code and makes it harder to read.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | whitespace_0.patch | 441 bytes | tangent |
Comments
Comment #1
tangent commentedI mistakenly created a new issue for this and submitted a patch to it. I'll close the other issue. Here's the patch.
Comment #2
tangent commentedThis is a bug IMO.
Comment #3
Steven commentedI fixed this by making the filter preserve indentation by replacing it with . I also tweaked the trimming not to strip out leading whitespace in a code segment.
This is better than the pre because it still allows the code to wrap.
Comment #4
tangent commentedIt is my opinion that wrapping code blocks should be avoided rather than intended. Code lines which wrap are often logically invalid. It would be better to allow them their content to scroll.
Comment #5
Steven commentedPre blocks are a tricky situation in themes. Overflow: auto won't work without some hacks in more advanced CSS-based themes.
In any case, the wrapping would be visually only. If you copy/paste, it is copied without wrapping. When you read the code on a website, I think wrapping is acceptable and even desirable.
Comment #6
tangent commentedSteven wrote:
This is a problem with the theme and not the fault of the property. I've noticed problems in Bluebeach dealing with unwrappable content and I assume this is the reason you don't allow any PRE styles.
On my website I would prefer to use the white-space: pre style but having the filter add nbsp to the content would defeat this. Therefore I wouldn't upgrade to your new update.
Comment #7
mcd commentedI'm also using white-space: pre; instead of the filter stuff, but I ran into an issue of preserving whitespace in printer-friendly pages (e.g., for books), where codefilter.css isn't linked automatically. I'll probably just hardcode misc/print.css, but I thought I'd warn people about it.
Comment #8
(not verified) commented