Jump to content

Option to set a default Code syntax highlighting


Recommended Posts


Please consider adding a simple admin option to choose the default Code syntax highlighting. HTML being preselected just doesn't fit to many communities and it is so unhandy to select manually something different each time the Code is inserted. Also, users are submitting content fast without even bothering to change the syntax from the menu and I have a lot of work to edit their posts.

Related topics here and here.


Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 2 months later...
  • 1 year later...

It seems to me that it is not so easy to add this option to ACP because it is a CKEditor plugin.

If you want to change the default code syntax highlighting, try going to applications\core\interface\ckeditor\ckeditor\plugins\ipscode\plugin.js

Open plugin.js 



and change the \x26lang\x3dhtml suffix to css or lua or something else.



I have not tested this method, so I do not guarantee that it will work.

Edited by SeNioR-
Link to comment
Share on other sites

Edit the following template:

core -> global -> editor -> code

At the very start of the template, place one of the following depending on your desired default entry:

{{$language = 'null';}}
{{$language = 'html';}}
{{$language = 'css';}}
{{$language = 'javascript';}}
{{$language = 'php';}}
{{$language = 'sql';}}
{{$language = 'xml';}}

null = 'No Syntax Highlighting'

Want to use one of the other entries as the default? I reckon you're going to have to get busy with some Javascript, and I'm not going there.

Note: this might result in existing codeboxes defaulting back to your chosen language instead of the actual language that is in the existing code...not tested that.

EDIT: or you could use the attached plugin 😉 plugin has one caveat to be aware of and that is noted in the settings.



(NE) Change 'Code' default language.xml

Edited by Nathan Explosion
Threw a plugin together
Link to comment
Share on other sites

  • 1 year later...

Did anyone ever find a solution to this problem?

I've been trying for years to find a way of adding a LISP code mode to the editor for syntax highlighting and getting no help as to how I might even begin such a thing. Assuming that is impossible, the option to change the default from HTML to no highlighting would at least be a step in the right direction.

Link to comment
Share on other sites

Marc Stridgen
This post was recognized by Marc Stridgen!

Nathan Explosion was awarded the badge 'Helpful' and 5 points.

25 minutes ago, cfish said:

Did anyone ever find a solution to this problem?

Well, yes...it is posted a few posts up, and the plugin that was made for those that don't want to edit the template has since been added to this:


Edited by Nathan Explosion
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...