BBcode with syntax highlighting of code snippets

Discussions related to the forums itself. Call for moderators. Trash Posts area.
Post Reply
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

BBcode with syntax highlighting of code snippets

Post by darkfrei »

Hi all!

Is it possible to highlight lua code on the forum?

some

Code: Select all

...
[/color] or [lua]...[/lua] or

Code: Select all

[code=lua]...
[/code]

With highlighting code reading is much easy as without.
code_highlighting_example.PNG
code_highlighting_example.PNG (14.4 KiB) Viewed 1605 times
What we have now:

Code: Select all

function rotationToPosition(rotation, position)
	-- makes position from rotation, absolute or relative
	local newPosition = {x=0, y=0}
	local oldPosition = position or {x=0, y=0}
	if 			rotation == 1 then newPosition = {	x=0, 	y=-1}
		elseif 	rotation == 2 then newPosition = {	x=1, 	y=0}
		elseif 	rotation == 3 then newPosition = {	x=0, 	y=1}
		elseif 	rotation == 4 then newPosition = {	x=-1, 	y=0}
		else return nil 
	end
	return {x = oldPosition.x + newPosition.x, y = oldPosition.y + newPosition.y}
end
What it could be (but with TABs)
Lua wrote:function rotationToPosition(rotation, position)
-- makes position from rotation, absolute or relative
local newPosition = {x=0, y=0}
local oldPosition = position or {x=0, y=0}
if rotation == 1 then newPosition = { x=0, y=-1}
elseif rotation == 2 then newPosition = { x=1, y=0}
elseif rotation == 3 then newPosition = { x=0, y=1}
elseif rotation == 4 then newPosition = { x=-1, y=0}
else return nil
end
return {x = oldPosition.x + newPosition.x, y = oldPosition.y + newPosition.y}
end

Generated by the BBify'r (http://clrhome.org/bbify/)

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: BBcode with syntax highlighting of code snippets

Post by ssilk »

I fear, that phpbb is not the best way discuss code.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

InflamedSebi
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri May 19, 2017 7:49 am
Contact:

Re: BBcode with syntax highlighting of code snippets

Post by InflamedSebi »

I support this. There is http://qbnz.com/highlighter/ which should work with phpbb as it started as an addon for this. But i never used it nor installed it ... just leave this here because this might become a thing.

Post Reply

Return to “This Forum”