Author Topic: Syntax Highlighting  (Read 11752 times)

0 Members and 1 Guest are viewing this topic.

Nikolay

  • Hero Member
  • *****
  • Posts: 1087
    • UnmanagedVisio
Syntax Highlighting
« on: May 23, 2010, 03:12:54 AM »
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:


« Last Edit: November 21, 2013, 04:32:58 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1729
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Syntax Highlighting
« Reply #1 on: May 25, 2010, 04:37:45 AM »
Code: c-sharp
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;

}
« Last Edit: November 21, 2013, 04:33:03 AM by Visio Guy »
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

  • Hero Member
  • *****
  • Posts: 1087
    • UnmanagedVisio
Re: Syntax Highlighting
« Reply #2 on: May 25, 2010, 04:56:00 AM »
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
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;
}
« Last Edit: November 21, 2013, 04:33:20 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1729
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Syntax Highlighting
« Reply #3 on: May 25, 2010, 05: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.
« Last Edit: November 21, 2013, 04:34:36 AM by Visio Guy »
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

  • Jr. Member
  • **
  • Posts: 42
Re: Syntax Highlighting
« Reply #4 on: May 25, 2010, 05:53:14 AM »
Code: java
 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?
« Last Edit: November 21, 2013, 04:34:41 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1729
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Syntax Highlighting
« Reply #5 on: May 25, 2010, 08:07:17 AM »
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.
« Last Edit: November 21, 2013, 04:34:30 AM by Visio Guy »
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

  • Hero Member
  • *****
  • Posts: 1087
    • UnmanagedVisio
Re: Syntax Highlighting
« Reply #6 on: May 25, 2010, 10:43:25 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  ;)
« Last Edit: November 21, 2013, 04:34:24 AM by Visio Guy »

Kuna

  • Newbie
  • *
  • Posts: 1
Re: Syntax Highlighting
« Reply #7 on: March 23, 2011, 11:50:55 AM »
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.
« Last Edit: November 21, 2013, 04:34:18 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1729
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Syntax Highlighting
« Reply #8 on: April 12, 2011, 11:16:53 AM »
Code: vb
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 ]:

Code
10 ? "Wow, when did syntax highlighting start working?"
20 GOTO 10
« Last Edit: November 21, 2013, 04:34:07 AM by Visio Guy »
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010