Page MenuHomePhabricator

Add "Switch view" for CSS/JS/Lua pages or user preference for that
Open, LowPublicFeature


Recently CSS & JS pages have been blocked from custom rendering and are rendered in monospace font with syntax hiliting. Although syntax hiliting is nice, this hardcoded behavior is not user friendly (besides it can be solved by wrapping the entire page in <pre> or <source>). Bug 10410 and bug 10422 show I'm true.

So I propose different approach to these pages which brings much better user friendliness:


  • add switch view pulldown to the header of CSS/JS pages to select regular wiki / pre / syntax hilite style of rendering - a bit similar to Special:Allmessages where you can choose either table or PHP view


  • add new preference called "Render CSS/JS pages as:" and the pulldown described above.

Let the user decide which style he likes.

(choose the way which is simplier to implement or suggest other with similat principle - user's ability to choose, I'd prefer user preferences because it will be global behavior setting, or both so user can override global behavior on such page temporarily)

PS: Why wikitext, pre and syntax hilight and not only wikitext and syntax hilight? Because syntax hilight produces hell-a-long pages while pre style with same view (monospace font) is much much shorter.

Version: 1.21.x
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:54 PM
bzimport set Reference to bz10621.
bzimport added a subscriber: Unknown Object (MLST).

Do not close the bugs without saying a reason. Reopened for discussion.

An extra switch would be undesireable. Please stick to the existing bugs for improving the fixed layout.

I just tried to open and my Firefox 18 got frozen so I had to kill it. Big DOM trees are still too difficult for browsers, so I would like to reopen discussion on this topic. I understand that syntax hilight is useful, no doubt about it. But sometimes it can become disruptive, as shown in this case. Optional solution would be to have client (JS) hilighter.

(In reply to comment #3)

I just tried to open [...]

I can confirm that this 30,000-plus-line monster is causing Google Chrome to lock up as well. The syntax highlighting balloons the size of the HTML to the point that the browser gets overwhelmed.

It does not even have to be such monster - you can simply have other stuff consuming your memory in given time - other tabs, other programs etc. so you really don't want to have your browser to explode.

Also think about people with limited internet connections (speed, FUP, price per kB etc...) is about 7,400 lines and seems fine in my browser. So somewhere between 7,400 and 30,000 lines, the HTML gets too big to be reasonable.

It may make sense to cap syntax highlighting at a certain number of lines (10,000 or so) or change the way in which it works (client-side JS instead of changing the rendered HTML?). The giant pages just don't seem sensible for huge pages with the current implementation when the whole mass of text can presumably just be wrapped in <pre> and load reasonably quickly.

On the other hand, using wiki pages as databases... this is headed down a dangerous road. This isn't code, it's structured data. :-/

I90c645f9d03bbdc135058a3717a463dec40aa77d (deployed today) disables highlighting of certain token types on very large files, so that aspect at least is resolved.

You can check to confirm.

Aklapper lowered the priority of this task from Medium to Low.Aug 31 2019, 11:47 PM
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: wikibugs-l-list.