Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-10-24 15:30:26

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Styling code blocks

I like the way Destry has styled the code blocks in Textbook, no need for horizontal scroll bars anymore. Would it be a good idea to use that for the forum as well (add white-space: pre-wrap; to div.postmsg pre)? Being able to take in the presented code at a glance seems like a good thing IMO.

Last edited by els (2008-10-24 15:37:01)

Offline

#2 2008-10-24 15:47:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Styling code blocks

Els wrote:

Being able to take in the presented code at a glance seems like a good thing IMO.

+1 from me. Especially since the wraps are ‘soft’ breaks so if you copy it, any code that has been wrapped onto a multiline still comes out on one line when you paste.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2008-10-31 20:50:10

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Styling code blocks

Sorry for bumping this. I’d really like to see this implemented. Is there anyone besides Mary who attends to the forum styling?

Offline

#4 2008-10-31 21:10:28

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Styling code blocks

I don’t like the idea: i think it’s better to see the code as it is, with out force wraps.

Offline

#5 2008-10-31 21:15:02

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Styling code blocks

Gocom wrote:

i think it’s better to see the code as it is, with out force wraps.

Why? In the Pages or Forms screens code gets wrapped as well.

Offline

#6 2008-11-01 07:54:45

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Styling code blocks

Els wrote:

Why? In the Pages or Forms screens code gets wrapped as well.

That’s why I don’t write code via Textpattern backend; usually directly to the db via editor, or with Firefox’s It’s All Text extension in random cases…

It’s really hard to write or read force wrapped code; almost every developer can joint that statement. Tried to write PHP (or even XHTML) when it automatically wraps? No good, no good, you can’t even see the actual lines.

I don’t see your point either; Pages and Forms wrap because they are textareas. Textareas do that.

Last edited by Gocom (2008-11-01 07:54:55)

Offline

#7 2009-01-02 19:46:11

nemoorange
Plugin Author
From: Washington DC
Registered: 2006-11-29
Posts: 90
Website

Re: Styling code blocks

This tweak is an ideal candidate for a user style. If you’re a Firefox user, you’ll need to download the Stylish addon. Safari and Opera browsers have other options—see this article, under ‘User styling without Stylish’ at the bottom.

The code would look a little something like this:

@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("forum.textpattern.com") {
	div.postmsg pre { white-space: pre-wrap;  }
}

Then try it out on this thread.

Personally, I’m a no-wrap guy myself.


Txp admin themes | dropshado.ws – a blog for design noobs like me

Offline

#8 2009-01-02 20:41:04

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Styling code blocks

Since no one except Stef seemed to agree with me, I have this in my Stylish user style for a couple of month now :)

Offline

#9 2009-01-03 00:48:10

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Styling code blocks

Snap! I’m so used to textareas in TXP now that I find horizontal scrolling a PITA when reading code though I tend to think I’m in a minority so I keep the horizontal scrolling for code within my own articles.

Last edited by thebombsite (2009-01-03 00:48:36)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#10 2009-01-03 13:42:25

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Styling code blocks

I don’t like wrapping code lines. Either use shorter lines or use a bigger screen.

Offline

#11 2009-01-03 14:02:10

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Styling code blocks

Els wrote:

Since no one except Stef seemed to agree with me, I have this in my Stylish user style for a couple of month now :)

No, I agree too…


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#12 2009-01-03 14:10:21

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Styling code blocks

ruud wrote:

I don’t like wrapping code lines. Either use shorter lines or use a bigger screen.

That doesn’t always solve it though does it Ruud? Depends on how long the line is. I’m on 1440×900 and still get wraps. I did wonder though if there was some way of making textareas in TXP admin for Page, Form and Style tabs go “full-screen”??


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB