Code 1.1.3

No permission to download
Compatible XF 2.x versions
Visible branding


This addon makes code bbcode and code editor way more functional by adding copy, expand, collapse buttons, resizer bar and automatically adjusting the colors to fit chosen forum style.

This is an open source addon. Visit GitHub repository for source code.

All my addons are free...

But if you want to
  • Be informed of all news about developing new addons
  • Suggest and vote for new addons
  • Try beta versions
  • Receive 24-hour early access to new addons
Then you can support me on my Patreon!



Custom title

You can now specify a custom code block header title. For example, users can provide a filename for code blocks instead of writing it in the text or putting the whole code block inside a spoiler with filename title.

Custom title can be set via "Insert code" dialog:


You can also set the title directly in text editor by putting | charater and title text after language name in code bbcode.

Example: [code=php|My Custom Title]<? .... ?>[/code] will produce this codeblock:


Hovering custom title will show the code language:


Expand/Collapse buttons

Expand button smoothly increasing the height of code block until all the code is showing. It is visible only when code block height is LESS than the actual code size.

Collapse button smoothly decreasing the height of code block to it's default height which you can set in style properties. It is visible only when code block height is LARGER than default code block height.


Both expand and collapse buttons are visible when code block height is within min and max limits and invisible on code blocks that are smaller than default code block height.

The default height of code block can be set in style properties ("Code" section below "Messages"):


Copy button

Copy button simply copy the code right into your clipboard:


Line numbers

All code blocks have line numbers (up to 1000 lines). Line numbers can be turned off via style properties:



Every code block which code height is larger than the default height has a resizer bar. It allows users to vertically resize code block:


Common languages

I always thought there is something wrong about "Common languages". Why can't we set which languages are "common" to our specific forum? Weird...

With Code addon you can now set common languages right after "Allowed code languages" option in "Messages" option-group:




Default language

You can also set a default language code for "Insert code" dialog via "Default code language" option after common languages in "Messages" option-group:


Adaptive style

Code block colors and properties are not defined directly (hardcoded) — they inherit from forum style variables.

What does this mean?

It means that code blocks and all its parts (including scrollbars!) will be looking great automatically no matter what style/color palette forum is using.

However, you have to manually set code style type: light (by default) or dark depending on general style type of your forum:


This is how a code block will look like on the forum with dark theme:



  1. Download the addon
  2. Upload contents of upload folder to your forum root
  3. In admin control panel go to "Addons" section and install Code

WARNING: after unistalling all code blocks with custom titles will have an incorrect highlighting or will not be highlighted at all!
  1. Uninstall the addon from ACP
  2. Go to forum root folder and remove js/Code folder.
That's it!

All my addons are free...

But if you want to
  • Be informed of all news about developing new addons
  • Suggest and vote for new addons
  • Try beta versions
  • Receive 24-hour early access to new addons
Then you can support me on my Patreon!
First release
Last update
5.00 star(s) 3 ratings

More resources from CMTV

  • Criteria Builder
    Criteria Builder
    Import/export/write custom criteria for trophies, notices and user group promotions. NO LIMITS!
  • Username change
    Username change
    Ultimate username change functionality: managable history, criteria, widget, permissions and more!
  • Google Search
    Google Search
    Seamless integration of Google Search Engine with your forum search system
  • Math
    Math support and a handy button to insert it all rolled into one addon!
  • Question Threads
    Question Threads
    Create questions and mark best answers

Latest updates

  1. Bug fixes 1.1.3

    Fixed bugs Fixed all problems with horizontal scrollbar overlapping single-line code block content
  2. Important bug fixes 1.1

    Fixed bugs Fixed a bug with incorrect code block height when horizontal scrollbar is visible...

Latest reviews

I was able to add in a lua and VB language packs and had it all working almost instantly! (... instantly after I striped out all of the "visual-basic" references in the .min.js and rename them to "vb", and then use vb everywhere.) Great add on, I really appreciate it!

Follow instructions here for additional languages:
This mod is great, it does line numbers and copy button and dark/light theme and expand all in one mod. You had to use 3 mods before to get 75% of this functionality.
Love it, I always have to share code and the default viewer misses exactly what this addon does. Must have if you share code in your community.