News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Syntax Highlighting

Started by Nikolay, May 23, 2010, 08:12:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikolay

I think it would be nice to have syntax highlighting for "code" blocks (i.e. vb, C#, etc).
Would you consider installing "Syntax Highlighter" module for this forum?

To do that you can:
1. Download the "Syntaxhighlighter" module for the Simple Machines Forum (SMF) from SMF website
2. Install this module as following: Admin -> Packages -> Download Packages -> Choose File -> Choose that file -> Okay
3. Verify that it works :D

I mean, syntax highlighting would allow code blocks in posts look like this:



Visio Guy

#1
Code (c-sharp) Select

using SyntaxHighlighter;

public class ThanksNikolay
{
  // Ok, I've installed the Syntax Highlighter mod, but it's not clear
  // to me how to turn on the rich formatting, with colors and line
  // numbers, etc.
  //
  // This block uses the modified tag [nobbc]'[code=c-sharp]'[/nobbc], so the formatting
  // is a bit better, but not quite as nice as it could be!

  bool optionsSet = false;

}
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nikolay

#2
Hm. that's odd... It seems it doesn't work for some reason...
Means, to use it you just put language name after "code" (see screenshot).
Before suggesting that I have tried that on my local computer - it did work.. Means, this seems to be doable in principle :D

TEST:
Code (csharp) Select

using SyntaxHighlighter;
public class ThanksNikolay
{
  // Ok, I've installed the Syntax Highlighter mod, but it's not clear
  // to me how to turn on the rich formatting, with colors and line
  // numbers, etc.

  bool optionsSet = false;
}

Visio Guy

#3
The mod version I installed is 1.0. Maybe it's old. There wasn't a newer version on the SMF site, or I need to use the "Manual Install Instructions for SMF", "Parse" stuff, which I don't understand and don't really have time to play with right now.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

geh_heim

#4
Code (java) Select
System.out.println("this is java!");

hey there just looked at everything and the 1.5 version is available here :
http://code.google.com/p/syntaxhighlighter/

maybe that will work?

Visio Guy

#5
The latest download is in .rar format, which doesn't load into SMF. I'm not going to ftp it automatically, no time today.

I think I will wait for SMF to release it's 2.0 version, then do more customizations to the forum. No sense doing a lot of work now, only to have tons of compatibility issues in a few months.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nikolay

#6
Quote from: Visio Guy on May 25, 2010, 10:14:09 AM
The mod version I installed is 1.0. Maybe it's old. There wasn't a newer version on the SMF site, or I need to use the "Manual Install Instructions for SMF", "Parse" stuff, which I don't understand and don't really have time to play with right now.

I've tried exactly the same versions of SMF and SyntaxHiligher on my machine (1.1.11 and 1.0 respecively) - it worked (the screenshot I have attached to the first post was made this way).. Maybe you need to "chmod" installed files if you have linux hosting..? Or maybe you need to add read permission for the hilighter directory on your hosting... Or maybe indeed you can try manual installation as well when you have time.

Anyways that was just an idea of course; I thought that it would be quite easy to do this enhancement  ;)

Kuna

#7
I see, Syntax highlighting finally works on this forum. What was wrong, How are you solved problem?
I'm have the same problem, and I dont know how to solve it.

Visio Guy

#8
Code (vb) Select

10 ? "Wow, when did syntax highlighting start working?"
20 GOTO 10


Ah, I see, you have to write [ code=some_language ]. Above, I have [ code=vb ], below I have only [ code ]:


10 ? "Wow, when did syntax highlighting start working?"
20 GOTO 10
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 299 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1196KB.
Tokens: post-login.
Cache hits: 13: 0.00200s for 26,739 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]