[RFC] GeSHi highlighting

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
tbackoff
Registered User
Posts: 180
Joined: Sat Jun 12, 2010 3:25 am

[RFC] GeSHi highlighting

Post by tbackoff »

OK, so phpBB currently uses the highlight_string function to highlight PHP code on a phpBB board. This work fine for PHP code, but the software neglects to include coloring for other programming languages (specifically for phpBB - HTML, CSS, Javascript, etc). GeSHi is a syntax highlighter that supports multiple programming language. Best of all, since it originally began as a project for phpBB, it should be easy to integrate.

With help from AmigoJack and James78, I have successfully added GeSHi to a phpBB 3.0.10 install, and I feel it would be beneficial to the community as a whole (even if a forum isn't centered around web development, but other programming, GeSHi supports those too - think C++, etc). What is everyone's thought about this?

Things to consider:
  • GeSHi sometimes uses letters in the programming language file name (C++ is cpp). If integrated, do we add code so that users can enter one or the other or both?
  • If no syntax is given, what do we do? I'm partial to showing the default code box.
  • Line numbers. I personally despise them, but some users might want these. Do we add an ACP option? If so, global or per-forum?
  • Styling GeSHi's output. I believe the default is bold and italics. Do we keep this or do we override this with some CSS?
  • Removing the highlight_string function. Since GeSHi already highlights PHP code, we should consider removing the highlight_string function from the core.
Post your thoughts peeps! :D
Last edited by MichaelC on Mon May 07, 2012 9:54 pm, edited 1 time in total.
Reason: Add [RFC] Prefix

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: GeSHi highlighting

Post by MichaelC »

I personally would love this feature and most of us at phpBB.com would. But as of late the only forums I have been around is coding ones. I think we really need to look and see, is this something the majority of boards would use? Or just something which all of us on this board would use as most of us code/post about code quite a bit (thats why we are here). Despite this we still have the existence of the code tag and even the php code tag, so why not have this?

So I'll say in my view, +1. But I'm not sure how useful this would be to the wider phpBB user base.

EDIT: Could you post a copy of your GeSHi MOD for whoever implements it into the core?
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
tbackoff
Registered User
Posts: 180
Joined: Sat Jun 12, 2010 3:25 am

Re: GeSHi highlighting

Post by tbackoff »

Unknown Bliss wrote:But I'm not sure how useful this would be to the wider phpBB user base.
A Google search for "coding phpbb" turns up multiple websites on the first two pages. I didn't check them all, but I recognize most of the domains.
Unknown Bliss wrote:EDIT: Could you post a copy of your GeSHi MOD for whoever implements it into the core?
I could, but why not do a pull request? :D

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: GeSHi highlighting

Post by MichaelC »

t_backoff wrote:
Unknown Bliss wrote:But I'm not sure how useful this would be to the wider phpBB user base.
A Google search for "coding phpbb" turns up multiple websites on the first two pages. I didn't check them all, but I recognize most of the domains.
Unknown Bliss wrote:EDIT: Could you post a copy of your GeSHi MOD for whoever implements it into the core?
I could, but why not do a pull request? :D
Even having 3,000 coding forums using phpBB would be a small percentage?
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
tbackoff
Registered User
Posts: 180
Joined: Sat Jun 12, 2010 3:25 am

Re: GeSHi highlighting

Post by tbackoff »

Unknown Bliss wrote:Even having 3,000 coding forums using phpBB would be a small percentage?
Possibly, yes. I'd be interested how others feel.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] GeSHi highlighting

Post by brunoais »

I say that this is what I'd call a great extension.
I think the overhead of this does not make it worthwhile for the core. Many forums that run phpBB are forums related to coding, right.
I still believe that that is not enough to have such feature in the core.
So, -1 for core. Great as an extension
(technical stuff under this)
This is something very easy to place. This is just something that processes text.
Having that into account, I believe we just need to insert geshi into the BBcode parser (the part before displaying the post).
A nicely placed event will make the extension making simple enugh.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] GeSHi highlighting

Post by callumacrae »

+1 for the core.
Made by developers, for developers!
My blog

Senky
Extension Customisations
Extension Customisations
Posts: 315
Joined: Thu Jul 16, 2009 4:41 pm

Re: [RFC] GeSHi highlighting

Post by Senky »

brunoais wrote:I say that this is what I'd call a great extension...
+1 for this

How big/demanding is GeSHi? Would not this rapidly slow down the page loading?

If adding to core, I would preffer not to load whole GeSHi until at least one CODE tag requires it.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] GeSHi highlighting

Post by callumacrae »

Senky wrote:
brunoais wrote:I say that this is what I'd call a great extension...
+1 for this

How big/demanding is GeSHi? Would not this rapidly slow down the page loading?

If adding to core, I would preffer not to load whole GeSHi until at least one CODE tag requires it.
It's not too demanding, and it would be cached.
Made by developers, for developers!
My blog

User avatar
tbackoff
Registered User
Posts: 180
Joined: Sat Jun 12, 2010 3:25 am

Re: [RFC] GeSHi highlighting

Post by tbackoff »

Senky wrote:If adding to core, I would preffer not to load whole GeSHi until at least one CODE tag requires it.
This is totally possible. Instead of including the file at the beginning of /includes/message_parser.php, simply do something like this:

Code: Select all

if ($syntax)
{
    // some stuff

    global $phpbb_root_path, $phpEx;
    include_once( $phpbb_root_path. 'includes/geshi.'. $phpEx );

    // some more stuff
}

Post Reply