The state of code highlighting in s9y

Creating and modifying plugins.
Post Reply
User avatar
yellowled
Regular
Posts: 7002
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

The state of code highlighting in s9y

Post by yellowled » Fri Mar 18, 2016 8:59 pm

I just took a look at plugins that provide syntax highlighting in s9y. If you're not familiar with it, there are currently three plugins available:
  • serendipity_event_geshi – a markup plugin which requires author to write extra, BB-Code-like markup for code highlighing; it seems to work quite well, but apparently uses quite a bit of server ressources(?) (not sure about that)
  • serendipity_event_dpsyntaxhighlighter – I assume this is supposed to work without extra markup or even classes, but I can't tell since I couldn't get it to work; more importantly, the JS plugin it uses has seen its last (official) release in July 2010; the author seems to be still working on it, however
  • serendipity_event_prettify – which was broken, but I think I managed to fix that; the JS plugin it uses also is still actively maintained, but they don't seem to do versioning(?)
First thing that is noticable is that we have three plugins for one purpose, which is not very s9y-like. Yes, Geshi is a bit different in that it's more like Markdown or Textile than like the other two, but still. It's odd. Also, there's two plugins that use 3rd-party assets that don't seem to have been maintained in a “good” way. (Also, I think the s9y plugins could be done better in terms of emitting CSS/JS and handling configuration, but that's a different question.)

Can anyone tell if dp and prettify could be combined or does that not make sense? Also, while we're at it, could we add prism to the plugin? It's a very modern, lightweight syntax highlighter, actively maintained. Or should I just try to create a fourth plugin for prism? (I really don't want to and am not sure I could.)

Don't get me wrong, this is not super-important or anything, I just think that it doesn't “look good” to not have a nice, working, current syntax highlighting plugin given that we have quite a large user base in the technical area.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: The state of code highlighting in s9y

Post by Timbalu » Sat Mar 19, 2016 10:25 am

You may also just use the CKEditor Plugin. It has a build-in codesnippet plugin (enabled by option) for the toolbar, which highlights your code with the famous highlight.js package. You will need to drop your code parts to this button form though to get it back prepared for the highlighter in the entryform. Very easy, very nice!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
yellowled
Regular
Posts: 7002
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: The state of code highlighting in s9y

Post by yellowled » Sat Mar 19, 2016 1:18 pm

Timbalu wrote:You may also just use the CKEditor Plugin.
Yeah, and if you want to make it really easy, you could embed GitHub gists. I know.

I assume most people that have code snippets in their blogs don't use the WYSIWYG editor, though. All three plugins (as well as prism, which I use via my blog theme) require specific classes to be added to the <pre> or <code> elements. I think most people who are aware of that write HTML or Markdown theses days (then again, what do I know?).

I still think this could/should be consolidated, but I guess it's not super important.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: The state of code highlighting in s9y

Post by Don Chambers » Mon Mar 21, 2016 4:13 am

Are you guys talking about code on the frontend, backend, or both?

User avatar
yellowled
Regular
Posts: 7002
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: The state of code highlighting in s9y

Post by yellowled » Mon Mar 21, 2016 9:18 am

Frontend.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: The state of code highlighting in s9y

Post by Timbalu » Mon Mar 21, 2016 9:57 am

CKEditor plugin: both. :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: The state of code highlighting in s9y

Post by Lux » Mon Mar 21, 2016 10:14 am

yellowled wrote:Can anyone tell if dp and prettify could be combined or does that not make sense? Also, while we're at it, could we add prism to the plugin? It's a very modern, lightweight syntax highlighter, actively maintained. Or should I just try to create a fourth plugin for prism? (I really don't want to and am not sure I could.)
I am OK with any change as long as I do not have to change old articles manually.

In other words: We should have a migration path for old articles.

Cheers

Dirk

Post Reply