Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn on syntax highlighting in etherpad

There are many free etherpad implementations since it went open source. Does etherpad support syntax highlighting or is some kind of add-on available?

I tried http://typewith.me/ http://sync.in/ http://www.piratenpad.de/

like image 762
Martin Preusse Avatar asked Aug 05 '10 11:08

Martin Preusse


3 Answers

You can install a plugin in Etherpad called "Syntax highlighting".

To install the plugin simple visit /admin/plugins on your Etherpad deployment and then search for "syntax" and click Install.

For details on the plugin see https://npmjs.org/package/ep_syntaxhighlighting

like image 199
Frozen_byte Avatar answered Oct 14 '22 20:10

Frozen_byte


UPDATE: Syntax highlighting is available as a plugin in the current Etherpad -- see John's answer below.

The original etherpad creators were working on highlighting, but complex sync-problems made them abandon that feature -- as documented in a .txt file in the source code.

Many etherpad sites run on a mostly standard etherpad.org release. If highlighting would get added, you'd probably see it quickly adopted at sketchpad.cc. Perhaps watch them and wait? Or if you really want highlighting, a good first attempt/experiment would be the read-only view. Example: http://sketchpad.cc/sp/pad/view/BACfNDybki/latest Try to use some existing highlighting javascript library to highlight the text inside DIV#padcontent or perhaps $('DIV#padcontent')[0].textContent

The complexity is getting the highlighted text formatting back into the DB. For this you might need to use operational transformations (which is the foundations of etherpad and as of recently also used in the Google Docs word processor). A tutorial: http://www.codecommit.com/blog/java/understanding-and-applying-operational-transformation

like image 40
Simon B. Avatar answered Oct 14 '22 20:10

Simon B.


The etherpad plugin ep_codepad provides syntax highlighting - based on highlight.js - for etherpad.

https://www.npmjs.com/package/ep_codepad

like image 1
Király István Avatar answered Oct 14 '22 21:10

Király István