Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+7 votes
3.5k views
in Plugins by
edited by

I've made the Syntax Highlighter plugin for Question2Answer. Any volunteers for testing? You can download it here:

http://quanda.pl/download/syntax-highlighter.zip

I need feedback on compatibility with different browsers (in firefox 3.6.13, and IE 8 works fine) and possibly conflicts with other plugins (I haven't found any).

EDIT:

Installation instructions:

  1. Download the file and unzip
  2. Place unzipped files in /qa-plugin/syntax-highlighter directory of your Q2A site

Usage:

Just wrap your code in one of the following:

[source language='css']code here[/source]
[code language='css']code here[/code]
[sourcecode lang='css']code here[/sourcecode]
[source lang='css']code here[/source]
[code lang='css']code here[/code]
[sourcecode='css']code here[/sourcecode]
[source='css']code here[/source]
[code='css']code here[/code]
[lang='css']code here[/lang]
[css]code here[/css] (or any of the supported language)

Supported languages:

  • as3, actionscript3
  • bash, shell
  • cf, coldfusion
  • c-sharp, csharp
  • cpp, c
  • css
  • delphi, pas, pascal
  • diff, patch
  • erl, erlang
  • groovy
  • js, jscript, javascript
  • java
  • jfx, javafx
  • perl, pl
  • php
  • plain, text
  • ps, powershell
  • py, python
  • rails, ror, ruby
  • scala
  • sql
  • vb, vbnet
  • xml, xhtml, xslt, html, xhtml
by
I uninstalled it because it breaks my RSS feeds. Can you fix this bug? The plugin should leave the RSS feeds unmodified, right?
by
The link is broken.
by
Anyone has mirror ?

5 Answers

0 votes
by
just testing
0 votes
by
Ive been looking all over for a solution like this, however I do get some weird results. The sourcecode window seems to also print the html tags from the WYSIWYG editor. How can this be avoided?
by
Have you tried to paste the code into notepad firstly to get rid of all invisible html tags and then copy from notepad and paste into Q2A?
0 votes
by
edited by
It works! Great job Ernest! :) I'm wondering though, is there a way to 'wrap' long lines of code, so that the layout doesn't get messy (and prevents from having to use the horizontal scroll bar)? That would make it a perfect plugin!

Edit:

I just found that line wrapping isn't possible in version 3 (https://bitbucket.org/alexg/syntaxhighlighter/issue/224/horizontal-line-wrapping-doesnt-work ), but it did work in version 2. Can this be added to the plugin, or, alternatively, could you give some pointers as to how to downgrade this plugin?
by
You are absolutely right. Version 3 doesn't support line wrapping. I've chosen this version because I had some problems with copying source code in v.2 But I'll try to make another plugin for version 2 as well. I only need some time ;)
by
That would be awesome Ernest. However, the current version also works good, so thanks already for that great job, stil haven't found any errors with it. :)
0 votes
by
I just testing your plugin, it works but the source code was displayed with so many empty lines, its like one paragraph for one code line, eating so much space, can you help me how to fix this ?? thank you for developing this plugin :)
0 votes
by

I've uploaded a version of the markdown plugin to GitHub that does highlighting:

https://github.com/NoahY/q2a-markdown-editor

Here's the thread for it with some screenshots:

http://www.question2answer.org/qa/12926/testing-markdown-syntax-highlighting-plugin

...