Author Topic: [Forum] Code highlighting  (Read 2543 times)

0 Members and 1 Guest are viewing this topic.

Maxs

  • Newbie
  • *
  • Posts: 19
    • View Profile
[Forum] Code highlighting
« on: July 07, 2015, 12:57:17 AM »
There are more and more code that's shared on this forum. It is really nice! :)

But I think it is quite painful to read the code that aren't colorized.

I'm not familiar with SMF but I suppose that there are plugins for that, it would really be an improvement.
SQE developer

oclero

  • Administrator
  • Full Member
  • *****
  • Posts: 166
    • View Profile
Re: [Forum] Code highlighting
« Reply #1 on: July 07, 2015, 08:56:52 PM »
I was looking the other day for adding some improvements, and use another theme. But I don't have any time for the moment!

PS : I love your signature

oclero

  • Administrator
  • Full Member
  • *****
  • Posts: 166
    • View Profile
Re: [Forum] Code highlighting
« Reply #2 on: July 11, 2015, 01:02:05 PM »
I installed a package to display code with syntax highlighting.
Here is an example :

Code: (cpp) [Select]
void little_test() {
    std::cout << "Is it better like this ?";
}

You just have to select the language the code combobox in the editor. I added just Lua and C++ but the plugin supports over 200+ languages  ;)

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1186
    • View Profile
Re: [Forum] Code highlighting
« Reply #3 on: July 11, 2015, 01:32:44 PM »
Very nice! Thanks Neovyse!

Maxs

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: [Forum] Code highlighting
« Reply #4 on: July 13, 2015, 03:35:21 PM »
That's perfect, thanks! :)

Code: (lua) [Select]
function little_answer()
  print("Yes it is! :p")
end
SQE developer

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1186
    • View Profile
Re: [Forum] Code highlighting
« Reply #5 on: July 13, 2015, 03:49:55 PM »
Code: (lua) [Select]
-- A comment with a "string"
local s = "A string with a -- comment"
-- local s = "A string with a -- comment" -- and then a "comment"
local s = "A string with a -- comment" -- and then a "comment"

local s = "bla" --[[ inline comment --]] .. "bli"

--[[ a multi lines comment ...
print("...")
--]]

--[==[ a multi lines comment ...
print("...")
--]==]

local str = [[
a multi lines string
...
]]

local str = [==[
a multi lines string
...
]==]
Except multi-line comments, it seems to work great.
At least better than the syntax highlighter I implemented in Solarus Quest Editor: https://github.com/christopho/solarus-quest-editor/issues/63