[Forum] Code highlighting

Started by Maxs, July 07, 2015, 12:57:17 AM

Previous topic - Next topic
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

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

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  ;)


That's perfect, thanks! :)

Code (lua) Select

function little_answer()
  print("Yes it is! :p")
end
SQE developer

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