Author Topic: Syntax Highligting for Code  (Read 11274 times)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Syntax Highligting for Code
« on: June 08, 2011, 07:08:17 PM »
I found this SMF mod. http://custom.simplemachines.org/mods/index.php?mod=2109
It will format the code to match syntax colors and stuff. It would be used like this [code=alias][/code].

It includes all the supported languages, include Ruby. I think it'd be interesting to have. And as far as I know, the normal [code][/code] still works as well.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #1 on: June 08, 2011, 08:14:13 PM »
I've already tried to add that syntax highlighting a few times, but every time it was a complete disaster to implement or it would break everything else. I was going to try again the next time I have time.
« Last Edit: June 08, 2011, 08:15:24 PM by James McCloud »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Holyrapid

  • Astral Trancist
  • *****
  • Posts: 749
  • LV: 0
  • Gender: Male
  • Credit to FreshL on Deviantart
    • View Profile
    • My new Youtube channel!
Re: Syntax Highligting for Code
« Reply #2 on: June 09, 2011, 03:21:02 PM »
Well, if you get it to work, I'd say that it would make finding mistakes in codes easier, at least a little...

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #3 on: June 09, 2011, 04:27:13 PM »
You don't type code in the forum. And the syntax highlighting would only be applied to already posted stuff, not to the text you are typing.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #4 on: June 12, 2011, 01:11:27 AM »
Theres this project called GeSHi. There used to be an SMF mod but due to GeSHi's license it was removed from the SMF site. However, I have found a copy of it on the internet, if you want it I'll PM it to you.

More on GeSHi http://qbnz.com/highlighter/

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #5 on: June 22, 2011, 11:19:38 AM »
I've tried to integrate it today and I found two problems. The first one was that it simply didn't work. :/ The second one is this: http://code.google.com/p/syntaxhighlighter/wiki/Overview *points to part with performance*

EDIT: I added the Select option for code, though.
« Last Edit: June 22, 2011, 11:44:45 AM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #6 on: June 22, 2011, 12:13:28 PM »
Woo! Bans over! Anyways, theres still this.

Theres this project called GeSHi. There used to be an SMF mod but due to GeSHi's license it was removed from the SMF site. However, I have found a copy of it on the internet, if you want it I'll PM it to you.

More on GeSHi http://qbnz.com/highlighter/

EDIT:

Code: [Select]
Sexy






Select







Button





*orgrasms*
« Last Edit: June 22, 2011, 12:33:45 PM by game_guy »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #7 on: June 22, 2011, 01:43:10 PM »
Yeah, I know. I'll try that one another time.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #8 on: August 01, 2011, 11:26:30 AM »
That GeSHi syntax works pretty good. Pretty fast too.
http://www.decisive-media.net/index.php?topic=106.msg646#msg646

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #9 on: February 07, 2013, 11:22:57 AM »
I wasn't able to integrate this syntax highlighting mod due to some problems when I tried to a few months back. But Ryex was able to backport a mod from SMF 2.x which I will add over the course of the next few days. You can all thank Ryex by giving him a blowjob. Or even better: give me a blowjob. I love you all. <3
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #10 on: February 07, 2013, 11:24:22 AM »
The things I do when I get board but don't really want to work on the things I need to...
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #11 on: February 09, 2013, 09:21:17 PM »
Glad to finally see this happening. Pretty awesome. :3

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #12 on: February 16, 2013, 07:06:24 PM »
I added it. I had to first fix a few small problems (and a big one) with the add-on and afterwards adjust the style sheet, but after that everything is the way I want it.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4505
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: Syntax Highligting for Code
« Reply #13 on: February 16, 2013, 07:14:36 PM »
Just checked it out, looks nice.  Good work :)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #14 on: February 16, 2013, 07:16:37 PM »
I just finished applying everything on the dark themes, too. Now I only have to figure out why the "Select" button doesn't appear anymore and how to add back where it says "Code" is no name for the tag was specified.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #15 on: February 16, 2013, 08:13:15 PM »
looking pretty good if I do say so myself :P
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline ThallionDarkshine

  • Ethereal Devastator
  • ****
  • Posts: 268
  • LV: 55
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #16 on: February 16, 2013, 10:05:54 PM »
It looks like the <a> tag is there, its just that it has no text in it. Maybe something got messed up in the php or javascript and its not returning the text for the select button.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #17 on: February 16, 2013, 10:26:43 PM »
Does the code box appear in the center to anybody else except me? If yes, which browser are you using (I'm on Opera)?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4505
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: Syntax Highligting for Code
« Reply #18 on: February 16, 2013, 11:12:15 PM »
The box itself is stretched across the entire width of the post, and the text is aligned to the left, on Chrome.

Offline ThallionDarkshine

  • Ethereal Devastator
  • ****
  • Posts: 268
  • LV: 55
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #19 on: February 16, 2013, 11:59:12 PM »
It's the same in firefox as in chrome.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #20 on: February 18, 2013, 10:07:31 PM »
Welp, it looks good on the dark theme now. Enjoy folks. Blizzard probably did just as much work as I have on this.


for your information it attempts to auto detect the language but it can get confused if the section is small you can help it pick the language with the code tag property

[code=ruby][/code] Ruby
[code=php][/code] PHP
[code=cpp][/code] C++
[code=cs][/code]   C#

ect.

EDIT:
At least it would if the code tag still put that value after the :  is the code tag header...
FIX IT BLIZZ :(

(click to show/hide)
« Last Edit: February 18, 2013, 10:43:53 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #21 on: February 18, 2013, 11:03:57 PM »
I'll have to look into that another time. Judging by the code, I'm not even sure that feature is actually supported.

EDIT: I'll add that code right away. Let's see if it works.

EDIT: And you broke my selection code, Ryex. :P

EDIT: Alright, I added your code (with some modifications), but I don't think it's working.
« Last Edit: February 18, 2013, 11:11:30 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #22 on: February 18, 2013, 11:17:58 PM »
it doesn't always pick the right syntax sadly but most of the time it does and when it doens't half the time the addition of the right code type will help it pick. actually you might want to put an extra space after the :
« Last Edit: February 18, 2013, 11:19:57 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #23 on: February 18, 2013, 11:59:35 PM »
Sure, if it helps.

EDIT:

Code: (ruby) [Select]
int main()
{
    printf("Hellooooooooooooooooooooo.\n");
    return 0;
}

Code: (cpp) [Select]
int main()
{
    printf("Hellooooooooooooooooooooo.\n");
    return 0;
}

EDIT: I think all it really does is detect keywords, comments and stuff enclosed in quotes, etc.

EDIT: I updated Subs-Highlight.php in my DB in case you wanna use it. But be careful. I removed some stuff that I don't need.
« Last Edit: February 19, 2013, 12:16:40 AM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #24 on: February 19, 2013, 12:51:48 AM »
I figured it out. if you explicitly set the class of the code tag it uses that highlighting
also only the

Code: [Select]
'type' => 'unparsed_equals_content', should set the code header I realized

Code: (php) [Select]
// Code tag
function ch_code_tag(&$codes)
{
    global $modSettings, $txt, $settings;

    $darkThemeIDS = array(3, 5, 7, 9, 11, 13);

    if (in_array($settings['theme_id'], $darkThemeIDS))
    {
        $codeWrapHTML1 = '<div class=\"block_code\" id=\"code_a" . $codecounter . "\"><div class=\"dark_theme_code\"><pre><code>$1</code></pre></div></div>"';
        $codeWrapHTML2 = '<div class=\"block_code\" id=\"code_b" . $codecounter . "\"><div class=\"dark_theme_code\"><pre><code class=\"" . $data[1] . "\">$1</code></pre></div></div>"';
    }
    else
    {
        $codeWrapHTML1 = '<div class=\"block_code\" id=\"code_a" . $codecounter . "\"><pre><code>$1</code></pre></div>"';
        $codeWrapHTML2 = '<div class=\"block_code\" id=\"code_b" . $codecounter . "\"><pre><code class=\"" . $data[1] . "\">$1</code></pre></div>"';
    }

    if (!empty($modSettings['ch_enable']))
    {
        foreach ($codes as $tag => $dump)
            if ($dump['tag'] == 'code') unset($codes[$tag]);
            
        $codes[] =  array(
            'tag' => 'code',
            'type' => 'unparsed_content',
            'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
                global $txt;
                // select all and copy code to clipboard mod
                static $codecounter = 0;
                $codecounter++;
                $tag[\'content\'] = "<div class=\"codeheader\">" . $txt[\'smf238\'] . ": <a href=\"javascript:void(0)\" title=\"" . $txt[\'codeselectall\'] . "\" onclick=\"javascript:selectall(\'code_a" . $codecounter . "\');return false;\">" . $txt[\'codeselectall\'] . "</a></div>' . $codeWrapHTML1 . ';
            '),
            'block_level' => true,
        );
        $codes[] = array(
            'tag' => 'code',
            'type' => 'unparsed_equals_content',
            'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
                global $txt;
                // select all and copy code to clipboard mod
                static $codecounter = 0;
                $codecounter++;
                $tag[\'content\'] = "<div class=\"codeheader\">" . $txt[\'smf238\'] . ": " . $data[1] . " <a href=\"javascript:void(0)\" title=\"" . $txt[\'codeselectall\'] . "\" onclick=\"javascript:selectall(\'code_b" . $codecounter . "\');return false;\">" . $txt[\'codeselectall\'] . "</a></div>' . $codeWrapHTML2 . ';
            '),
            'block_level' => true,
        );          
    }
    
    // Copyright Info
    if (isset($context['current_action']) && $context['current_action'] == 'credits')
        $context['copyrights']['mods'][] = '<a href="http://dragomano.ru/page/code-highlighting" target="_blank">Code Highlighting</a> &copy; 2010&ndash;2012, Bugo';
}


tags you can use for code highlighting:

  • python
  • profile (like output form python's profiler)
  • ruby
  • perl
  • php
  • scala
  • go
  • xml (also supports HTML with inline css and javascript)
  • markdown
  • django (Django templates)
  • css
  • json
  • javascript
  • coffeescript
  • actionscript
  • vbscript
  • http (like output from curl the standard way HTTP headers as displayed in text)
  • lua
  • applescript
  • delphi
  • java
  • cpp (c++)
  • objectivec
  • vala
  • cs (c#)
  • d
  • rsl (RenderMan RSL)
  • rib (RenderMan RIB)
  • mel (Maya Embedded Language)
  • glsl
  • sql
  • smalltalk
  • lisp
  • clojure
  • ini
  • apache (like .htaccess)
  • nginx
  • diff (SVN or GIT diffs ect.)
  • dos (DOS batch files)
  • bash (.sh scripts)
  • cmake
  • axapta
  • 1c
  • avrasm (AVR Assembler)
  • vhdl
  • parser3
  • tex (TeX)
  • brainfuck (BrainFuck)
  • haskell
  • erlang
  • erlang-repl
  • rust
  • matlab
  • r
  • no-highlight (disables highlighting)



You might want to update the actual highlight script too as I've noticed there has been a few updates since this this mode went out.
https://dl.dropbox.com/u/20709011/highlight.pack.js
« Last Edit: February 19, 2013, 01:26:02 AM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #25 on: February 19, 2013, 07:57:59 PM »
Code: [Select]
class A; end;
Code: (test) [Select]
class A; end;
Code: (Ruby) [Select]
class A; end;
Code: (ruby) [Select]
class A; end;
EDIT: It seems to be working except for one bug. When I used code tags without the =something part, then a weird L appears there (first example). You think you can fix that, Ryex?
« Last Edit: February 19, 2013, 08:00:38 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #26 on: February 19, 2013, 09:05:58 PM »
I already did in the code I posted. as I said the array with the type "unparsed_content" SHOULD NOT append the $data[1] part after the "Code:" text. only the "unparsed_equals_content" should

also, did you update the Highlight script like I suggested at the end of my last post?

I appears that as long as you use one of the tags I posted it will use that but if it doesn't recognize the tag it will auto detect anyway.
« Last Edit: February 19, 2013, 09:08:24 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #27 on: February 19, 2013, 09:53:50 PM »
Ah, I see now *fixes* and yes, I did.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #28 on: February 19, 2013, 10:24:39 PM »
well folks. there you go, one fancy Syntax Highlighting system fresh off the presses.

you may bow and bequeath us with favors as time permits.
shouts of adoration are appreciated but we, for the most part, can not return your feelings.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #29 on: February 19, 2013, 11:24:42 PM »
can not return your feelings.

Because we are robots.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #30 on: February 20, 2013, 07:49:19 AM »
I like how when I go into the script help section and I see a code tag it's all highlighted and stuff, makes my want to do a fist pump because my brain is like "OMG YES THIS IS SO EASY TO READ!"
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #31 on: March 13, 2013, 04:09:15 PM »
I just noticed that it seems to often fail to recognize the language, especially in short code segments. I think I'll set it to Ruby by default and then using code=something would allow different highlighting for other languages.

EDIT: Wow, this was frustratingly difficult. Not because it was a difficult thing to do, but because the javascript code looks like it's been horribly unreadable on purpose. :/ The variable names are usually just one letter and the entire thing is in one single line with no spaces. Anyway, this is how it's done.

There should be a code segment like this somewhere in the beginning:

Code: (javascript) [Select]
if(e[p[o]]||p[o]=="no-highlight"){return p[o]}
When this is added at the end, it causes the certain language to become default if none was specified:

Code: (javascript) [Select]
if(p[o]==""){return "ruby"}
EDIT: Hey, Ryex, there seems to be an error in the Ruby parser. Check out this script:

http://forum.chaos-project.com/index.php/topic,2312.msg174554.html#msg174554

Notice how the parameters labeled x0, y0, etc. have their numbers highlighted as if they were literals. This is wrong. :/ You think you can fix that?
« Last Edit: March 19, 2013, 09:32:39 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #32 on: April 11, 2013, 08:34:03 PM »
ya no. the highlight.js parser isn't easy to follow the code is a bit wonky. you can try seeing if there is a new update for it though. (checks himself.) nope last update was 13.10.2012
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #33 on: April 11, 2013, 11:23:37 PM »
See if this can at least be reported.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #34 on: June 23, 2014, 07:04:55 AM »
There has been an update to Highlight.js http://highlightjs.org/
Release 8.0 https://github.com/isagalaev/highlight.js/releases/tag/8.0

  • auto detection has been improved
  • a bunch of styles have been improved (including ruby's)
  • new languages added
  • language aliases have been added (ie `js` for javascript and `html` which previously had to xml)


and a bunch more.

update the .js file if you would please Blizz.
« Last Edit: June 23, 2014, 07:12:44 AM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #35 on: June 23, 2014, 07:47:08 AM »
I remember that I modded some things in the script. I don't think it will be just copy-paste, but I'll check it out.

EDIT: Nope, I simply can't get it to work. Replacing doesn't help and there are no instructions as to where to put the extra folders or if they need to be loaded separately. I tried using the prebuilt version, it didn't work either.
« Last Edit: June 23, 2014, 05:56:44 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #36 on: June 24, 2014, 05:55:21 AM »
use this https://dl.dropboxusercontent.com/u/20709011/Random%20Stuff/highlight.zip

you link the highlight.pack.js, link one of the styles from the style directory and you should be good to go.
« Last Edit: June 25, 2014, 05:07:35 AM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #37 on: June 24, 2014, 08:19:57 AM »
That might work. The old file I have is also called highlight.pack.js. I'll try it out when I get home from work.

EDIT: Nope, I'm still having trouble to get things running. It removes the select-code button and just turns everything into black text. I can give you CP's source if you feel like messing around with it.
« Last Edit: June 26, 2014, 10:26:55 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #38 on: September 23, 2014, 06:43:34 AM »
alright. time to mess around with this. toss it here Blizz. point me to the files in question (i've kinda forgotten :P)
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #39 on: September 23, 2014, 02:02:42 PM »
Alright, I'll send it to you when I get home.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #40 on: September 25, 2014, 06:23:38 AM »
done, check PM Blizz.

try useing this to help you select styles for light and dark themes instead of just edit test repeating
https://highlightjs.org/static/test.html

notice that you can select the them at the top

also this lists all the languages the highlighting supports as well as what aliases you can put in the
Code: [Select]
code=<lang> tag to force highlighting in a language. if there is enough of it the language should be auto detected but shot one liners might need some help.


Tomorrow Night Bright looks like a good dark theme
« Last Edit: September 27, 2014, 06:01:14 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #41 on: September 29, 2014, 06:26:33 PM »
Added.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #42 on: September 29, 2014, 09:09:55 PM »
Something is wrong, this is what it was dining to me before i stopped it from useing the old css. Something is preventing the css file from loading
« Last Edit: September 29, 2014, 09:13:13 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #43 on: September 29, 2014, 09:20:35 PM »
Try refreshing the site, clearing your cache and/or restarting your browser. When I first uploaded everything, it was totally broken. Then I pressed F5 and it was fine. Also, I removed the highlight.css in the default folder since it wasn't even being used anymore.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #44 on: September 30, 2014, 02:47:34 AM »
oh ok ya it's working now, I did some edits, it's easier to configure now as you only have to change the variables as the top of the script.
also
CODE IS PROPERLY FORMATED DURING A PREVIEW!

http://pastebin.com/wsbvtTFC

EDIT: I tried putting it in a code tag but the the existence of a code tag in the source just made it drop some of the script :(
« Last Edit: September 30, 2014, 02:57:18 AM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #45 on: September 30, 2014, 07:57:36 AM »
Finally, lol! I was already looking everywhere where vs.css was defined. xD I uploaded the new one.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #46 on: October 01, 2014, 02:10:37 AM »
ah crap I forgot the most important part


replace
Code: (php) [Select]
   // Preview
    if (!empty($modSettings['ch_enable']) && in_array($context['current_action'], array('post', 'post2')))
        $context['html_headers'] .= '
        <script type="text/javascript">
            var highlightPreviewCodeBlocks = function(){
                if (highlightPreviewCodeBlocks.calling)
                    return;
                highlightPreviewCodeBlocks.calling = true;
                var blocks = document.querySelectorAll("#preview_body pre code");
                Array.prototype.forEach.call(blocks, hljs.highlightBlock);
                highlightPreviewCodeBlocks.calling = false;
            };
            
            document.querySelector("#preview_body").addEventListener("DOMSubtreeModified", highlightPreviewCodeBlocks, false);
        </script>';

with
Code: (php) [Select]
   // Preview
    if (!empty($modSettings['ch_enable']) && in_array($context['current_action'], array('post', 'post2')))
        $context['html_headers'] .= '
        <script type="text/javascript">
            var highlightPreviewCodeBlocks = function(){
                if (highlightPreviewCodeBlocks.calling)
                    return;
                highlightPreviewCodeBlocks.calling = true;
                var blocks = document.querySelectorAll("#preview_body pre code");
                Array.prototype.forEach.call(blocks, hljs.highlightBlock);
                highlightPreviewCodeBlocks.calling = false;
            };

            var initPreviewHighlighting = function(){
                if (initPreviewHighlighting.called)
                    return;
                initPreviewHighlighting.called = true;
                document.querySelector("#preview_body").addEventListener("DOMSubtreeModified", highlightPreviewCodeBlocks, false);
            };

            var initPreviewHighlightingOnLoad = function(){
                document.addEventListener("DOMContentLoaded", initPreviewHighlighting, false);
                document.addEventListener("load", initPreviewHighlighting, false);
            };
           
            initPreviewHighlightingOnLoad();
           
        </script>';

otherwise the code to highlight code in the preview section when you click the preview button doesn't get attached as the preview section doesn't exist yet.
« Last Edit: October 01, 2014, 02:14:50 AM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #47 on: October 01, 2014, 03:44:02 AM »
Absolutely loving it. Awesome job Ryex.

Offline WhiteRose

  • Trying to code in Ruby
  • Moderator
  • Lexima Warrior
  • ***
  • Posts: 2341
  • LV: 127
  • Gender: Female
  • <3
    • View Profile
Re: Syntax Highligting for Code
« Reply #48 on: October 01, 2014, 07:51:58 AM »
Is it supposed to look like this, or is something not working properly for me?

(click to show/hide)

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2900
  • LV: 365
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Syntax Highligting for Code
« Reply #49 on: October 01, 2014, 08:22:48 AM »
It looked like that for me the first time too. But refreshing did the trick. It's one of those many mysteries of the internet~



(click to show/hide)
NNID: KK20-CP

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #50 on: October 01, 2014, 08:30:03 AM »
if it looks like that It means it' cached the old highlight.pack.js/css files and you need to force the page to refresh.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #51 on: October 01, 2014, 12:51:14 PM »
The same happens for me briefly after loading/reloading the site, just before the highlighting is applied. Even with the new code.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #52 on: October 04, 2014, 08:37:59 AM »
*double post* Ryex, something's wrong. Check out the script. Its line breaks are broken.

http://forum.chaos-project.com/index.php/topic,4284.0
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #53 on: October 04, 2014, 05:49:17 PM »
it's auto detecting as elixir instead of ruby. we should probably go and generate a Highlight.pack.js that doesn't include every language possible to avoid it detecting the weird languages.

we should probably go here and build a version with less than all the languages
https://highlightjs.org/download/
« Last Edit: October 04, 2014, 06:57:38 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #54 on: October 05, 2014, 05:14:49 PM »
Done.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #55 on: October 11, 2014, 08:27:10 PM »
I figured out why we get the weird formatting on non highlighted blocks of text (remember you can turn off hilightinging by useing code=nohighlight or code=no-highlight)
you need to add
Code: (nohighlight) [Select]
display: block;

to all your
Code: (css) [Select]
.code, pre.code {
...
}

blocks in your theme css files
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #56 on: October 12, 2014, 11:35:39 AM »
Done.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #57 on: October 25, 2015, 07:17:24 AM »
Dunno if it's something that can be fixed, but it doesn't seem to be liking the tab character.

You can clearly see there's a tab.


But it won't show it in the post.


Making scripts look like garbage.


Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #58 on: October 25, 2015, 08:51:09 AM »
IDK. ._.;
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #59 on: October 26, 2015, 07:30:34 PM »
it's because the web in general doesn't like the tab character there is no standardizes support for it's display.

replacing with spaces might be the only option
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: Syntax Highligting for Code
« Reply #60 on: October 26, 2015, 08:38:30 PM »
Would it be possible to use regexp and sub out the tab "\t" and replace with like 4 spaces "&nbsp;"?

Meant to originally post this here.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #61 on: October 26, 2015, 08:56:13 PM »
LOL!
turns out this functionality is already implemented.

there is a mod setting to configure how many space tabs a space gets replaced with
and this code is supposed to add that many spaces together to set up the tab replace.

this sequence should appear twice in Subs-Highlight.php

not sure why it's not working.
Code: [Select]
   $tab = '';
    if (!empty($modSettings['ch_tab'])) {
        while ($i < $modSettings['ch_tab']) {
            $tab .= ' ';
            $i++;
        }
    }
    // ...
    $js = "\n\t\t" . '<script type="text/javascript" src="' . $settings['default_theme_url'] . '/highlight.pack.js"></script>
        <script type="text/javascript">
        hljs.configure({
          tabReplace: "' . $tab . '",
          useBR: true
        });
        hljs.initHighlightingOnLoad();
        </script>';
« Last Edit: October 26, 2015, 08:59:19 PM by Ryex »
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #62 on: October 26, 2015, 09:22:29 PM »
Nope, not there AFAIK.

(click to show/hide)
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #63 on: October 26, 2015, 09:26:15 PM »
Quote
Number of characters between tab columns [ 4 ]
^^
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #64 on: October 26, 2015, 10:54:15 PM »
Wouldn't that mean it's already converted to spaces?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5128
  • LV: 197
  • Gender: Male
  • Wants to write a compiler for fun
    • View Profile
Re: Syntax Highligting for Code
« Reply #65 on: October 26, 2015, 10:54:52 PM »
it's supposed to yes, I'm not sure why it's not working.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19898
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Syntax Highligting for Code
« Reply #66 on: October 26, 2015, 11:27:23 PM »
Any chance you can find some time to look into it?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.