My Syntax Highlighter

Description

An easy to use, with intuitive interface, WordPress plugin that provides a simple way for embedding syntax-highlighted source code within pages or posts on your website, without losing it’s formatting or making any manual changes. Supporting 13 languages, 16 shortcodes and 36 themes. The syntax highlighting feature implemented via a CodeMirror library.

Syntax highlighting is a feature that displays source code, in different colors and fonts according to the category of terms. Syntax highlighting is one strategy to improve the readability and context of the text; especially for code that spans several pages. The reader can easily ignore large sections of comments or code, depending on what they are looking for.

This plugin also uses standalone Shortcode-Processor to prevent WordPress from converting newlines to HTML paragraphs, replacing apostrophes with typographic quotes and so on.

This plugin is just plug and play, no tedious configurations or hacks, just install, enable and start using your new shortcodes.

Features

  • Lightweight and fast
  • Secure code with using clear coding standards
  • Intuitive interface with many settings
  • Cross browser compatible (work smooth in any modern browser)
  • Compatible with all WordPress themes
  • RTL compatible (right to left)
  • Translation ready

Key features include

  • Standalone Shortcode-Processor
  • Code syntax highlighting
  • Line numbering
  • Dollar sign before line
  • 36 Themes
  • 13 Languages
  • 15 Shortcodes
  • Allow shortcodes in the text widget
  • And much, much more!

PRO features include

  • 56 Themes (all provided themes from CodeMirror)
  • 154 Programming languages (all provided languages from CodeMirror)
  • 125 Shortcodes
  • Programming language selection option
  • Loading CodeMirror files on pages only when needed
  • No ads on the settings page
  • Well documented

Get the PRO version now!

A list of supported languages:

Click to view language examples. Highlighted with Default theme.

A list of supported shortcodes:

  • [code][/code] – customizable shortcode
  • [php][/php]
  • [javascript][/javascript]
  • [js][/js]
  • [xml][/xml]
  • [html][/html]
  • [css][/css]
  • [scss][/scss]
  • [less][/less]
  • [sass][/sass]
  • [markdown][/markdown]
  • [perl][/perl]
  • [sql][/sql]
  • [mysql][/mysql]
  • [shell][/shell]

A list of supported themes:

  • 3024 day
  • 3024 night
  • Ambiance mobile
  • Ambiance
  • Base16 dark
  • Base16 light
  • Blackboard
  • Cobalt
  • Colorforth
  • Eclipse
  • Elegant
  • Erlang dark
  • Lesser dark
  • Liquibyte
  • MBO
  • MDN-like
  • Midnight
  • Monokai
  • Neat
  • Neo
  • Night
  • Paraiso dark
  • Paraiso light
  • Pastel on dark
  • Rubyblue
  • Solarized
  • The matrix
  • Tomorrow night bright
  • Tomorrow night eighties
  • TTCN
  • Twilight
  • Vibrant ink
  • XQ dark
  • XQ light
  • Zenburn

Translation

This plugin is ready for translation and has already been translated into several languages.

  • English (default)
  • Russian (translation by Milena Kiseleva)
  • German (translation by Michael)
  • Spanish (translation by Patricio Toledo)
  • Dutch (translation by Peter Leenders)

If you want to help translate this plugin then please visit the translation page.

Minimum system requirements:

  • PHP version 5.2 or higher.
  • MySQL version 5.0 or higher.

Recommended system requirements:

  • PHP version 7.0 or higher.
  • MySQL version 5.6 or higher.

Contribution

Developing plugins is long and tedious work. If you benefit or enjoy this plugin please take the time to:

“My Syntax Highlighter” is one of the own software projects of Space X-Chimp.

License

This plugin is licensed under the GNU General Public License, version 3 (GPLv3) and is distributed free of charge.
Commercial licensing (e.g. for projects that can’t use an open-source license) is available upon request.

Credits

Links

Screenshots

  • Plugin settings page.
  • An example of post with added source code and wrapped it in shortcode provided by this plugin. Default theme of highlighter.
  • An example of post with added source code and wrapped it in shortcode provided by this plugin. The "The Matrix" theme of highlighter.
  • An example of post with added source codes on multiple language and wrapped it in shortcode provided by this plugin. Default theme of highlighter.

Installation

Install “My Syntax Highlighter” just as you would any other WordPress Plugin.

Automatically via WordPress Admin Area:

  1. Log in to Admin Area of your WordPress website.
  2. Go to “Plugins” -> “Add New“.
  3. Find this plugin and click install.
  4. Activate this plugin through the “Plugins” tab.

Manually via FTP access:

  1. Download a copy (ZIP file) of this plugin from WordPress.org.
  2. Unzip the ZIP file.
  3. Upload the unzipped catalog to your website’s plugin directory (/wp-content/plugins/).
  4. Log in to Admin Area of your WordPress website.
  5. Activate this plugin through the “Plugins” tab.

After installation and activation, the “Syntax Highlighter” menu item will appear in the “Settings” section of Admin Area. Click on it in order to view the plugin settings page.

More help installing plugins

FAQ

Q. Will this plugin work on my WordPress.COM website?

A. Sorry, this plugin is available for use only on self-hosted (WordPress.ORG) websites.

Q. Can I use this plugin on my language?

A. Yes. This plugin is ready for translation and has already been translated into several languages. But If your language is not available then you can make one. The POT file is included and placed in the “languages” folder. Just send the PO file to us and we will include this translation within the next plugin update. Many of plugin users would be delighted if you share your translation with the community. Thanks for your contribution!

Q. How does it work?

A. Simply go to the plugin settings page, select the desired settings and click the “Save changes” button. Enjoy the fancy syntax highlighting on your website. It’s that simple!
You can find the plugin settings page at “WordPress Admin Area” -> “Settings” -> “Syntax Highlighter“.

Q. Does this plugin requires any modification of the theme?

A. Absolutely not. This plugin is configurable entirely from the plugin settings page that you can find in the Admin Area of your WordPress website.

Q. Does this require any knowledge of HTML or CSS?

A. Absolutely not. This plugin can be configured with no knowledge of HTML or CSS, using an easy-to-use plugin settings page.

Q. It’s not working. What could be wrong?

A. As with every plugin, it’s possible that things don’t work. The most common reason for this is a web browser’s cache. Every web browser stores a cache of the websites you visit (pages, images, and etc.) to reduce bandwidth usage and server load. This is called the browser’s cache.​ Clearing your browser’s cache may solve the problem.

It’s impossible to tell what could be wrong exactly, but if you post a support request in the plugin’s support forum on WordPress.org, we’d be happy to give it a look and try to help out. Please include as much information as possible, including a link to your website where the problem can be seen.

Q. The last WordPress update is preventing me from editing my website that is using this plugin. Why is this?

A. This plugin can not cause such problem. More likely, the problem are related to the settings of the website. It could just be a cache, so please try to clear your website’s cache (may be you using a caching plugin, or some web service such as the CloudFlare) and then the cache of your web browser. Also please try to re-login to the website, this too can help.

Q. Where to report bug if found?

A. Bug reports are very welcome! Please visit our contact page and report. Thank you!

Q. Where to share any ideas or suggestions to make the plugin better?

A. Any suggestions are very welcome! Please visit our contact page and share. Thank you!

Q. I love this plugin! Can I help somehow?

A. Yes, any contributions are very welcome! Please visit our donation page. Thank you!

Reviews

It does the job, but…

The Plugin is nice.

But some things are curious.

Why loads the plugin ALL unused code-languages-javascript files ?

Load only the stuff it’s needed to display the page. If there is no content of codes, all javascript has to be unloaded. Loading all code-languages is a very bad idea.

The PRO version supports 154 programming languages and 125 shortcodes. Really interesting, but one question. U load all the 154 javscript files on every page ? Bad idea! I hope u understand the problem. Don’t load stuff, that’s not need to display a page. Think of, traffic, pagespeed and similar. That’s a big mistake of the plugin.

Less is more.

Great Support!

Thank you for your quick support! We were seeing a formatting bug and Arthur was very willing to troubleshoot and quickly issue an update without asking for any donation in return (although, after work was completed a donation was made). This plugin has many different themes to apply to the code, is easy to use and well maintained!

Read all 4 reviews

Contributors & Developers

“My Syntax Highlighter” is open source software. The following people have contributed to this plugin.

Contributors

“My Syntax Highlighter” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “My Syntax Highlighter” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.36

  • Improvement: Design of the plugin settings page is improved.

2.35

  • Improvement: Design of the plugin settings page is improved.
  • Content of the “Usage Instructions” section updated.
  • Translation files are updated.

2.34

  • CSS code, which is located in the file “admin.css” and is related to the “FAQ” section, is improved.
  • The sidebar items are rearranged.
  • Some texts are updated.
  • Translation files are updated.

2.33

  • In the ‘settings.php’ file, the variables ‘languages’ and ‘themes’ to which the default/empty item was added are renamed to ‘languages_plus’ and ‘themes_plus’ respectively.
  • The translation into Russian has been corrected.
  • The translation into Dutch has been corrected.

2.32

  • Dutch translation added. (Thanks to Peter Leenders)
  • The code block that adds dynamic JavaScript is moved to a separate function ‘_load_scripts_dynamic_js’ within the ‘enqueue.php’ file.
  • The code block that adds dynamic CSS is moved to a separate function ‘_load_scripts_dynamic_css’ within the ‘enqueue.php’ file.
  • The function ‘_load_scripts_codemirror’ is improved. Removed an unnecessary call of constants.
  • The function ‘_load_scripts_admin’ is improved.
  • The function ‘_load_scripts_frontend’ is improved.
  • The banner of Space X-Chimp, located on the settings page of the plugin, is updated. The image ‘banner.png’ is deleted.
  • Some texts are updated.
  • All translation files are updated.

2.31

  • The code block that enqueue the CodeMirror library files is moved to a separate function ‘_load_scripts_codemirror’ within the ‘enqueue.php’ file.
  • Enqueue of the CodeMirror addons is moved to the beginning of the queue, before enqueuing the CodeMirror mods.
  • The extra mention of the constant ‘_SLUG’ is removed from the file ‘enqueue.php’.
  • All translation files are updated.

2.30

  • New feature added: Loading of the CodeMirror files on pages occurs only when needed. If a page does not contain a shortcode, then the CodeMirror files will not be added to the page. Previously, this feature was available only in the PRO version of the plugin.

2.29

  • Fixed localization of the word “licence”. (Thanks to Garrett Hyder @garrett-eclipse)
  • Fixed: CodeMirror addon ‘autorefresh.js’ was added to one of the previous versions of the plugin, but it was not enabled.

2.28

  • The shortcode “bash” is removed because of uselessness. Users can use the shortcode “shell” to highlight the BASH code.
  • Added code for loading the addons of the CodeMirror library.
  • Added the addon ‘autorefresh.js’ to the CodeMirror editor. The code for manual refreshing the CodeMirror editor is deleted.

2.27

  • CodeMirror library updated to the latest version v5.38.0. The directory structure is changed (files are better organized).

2.26

  • Fixed a bug due to which the plugin data that stored in the database to not be deleted during the uninstallation of the plugin.
  • The contents of the file ‘uninstall.php’ is moved to the file ‘core.php’. The file ‘uninstall.php’ is deleted.
  • Some texts are corrected.

2.25

  • Added information about the PRO version of the plugin.
  • Translation files updated.

2.24

  • Fixed bug: “WARNING: /inc/php/enqueue.php:26 – Illegal string offset ‘theme'”.

2.23

  • Added new constant “_FILE”.
  • Added a function that runs during the plugin activation. Now the date of the first activation of the plugin is recorded in the database.
  • Some texts updated, and typos corrected.

2.22

  • Added a callback function that returns an HTML tables of shortcodes. In the “Usage” tab on the plugin settings page added two tables showing the available shortcodes.
  • Translation files updated.

2.21

  • The ‘codemirror-settings.js’ file updated. The mime for the modes ‘scss’, ‘less’, ‘shell’, and ‘bash’ are changed from ‘text/css’, ‘text/css’, ‘text/x-php’ and ‘text/x-php’ to ‘text/x-scss’, ‘text/x-less’, ‘text/x-sh’ and ‘text/x-sh’ respectively.
  • The function ‘_shortcode’ updated. Variables are renamed for easier reading.

2.20

  • CodeMirror library updated to the latest version v5.37.0. The directory structure is changed (files are better organized). Added a test files for the CodeMirror modes.
  • The ‘codemirror-settings.js’ file updated. The ‘mode’ variable renamed to ‘mime’. The default value for the ‘mime’ variable changed to ‘text’. The typo is corrected. (Thanks to Evan Anderson @ejdanderson)
  • Added a function for getting the names of the CodeMirror modes by scanning the CodeMirror library included in the plugin. (Thanks to Evan Anderson @ejdanderson)
  • Added a callback function that returns an array of pairs “Language Name” => “mode” of the CodeMirror modes. (Thanks to Evan Anderson @ejdanderson)
  • Added a callback function that returns an array of pairs “theme” => “Theme Name” of the CodeMirror themes.
  • Added a callback function that returns an array of shortcode names.
  • Updated the method of loading the CodeMirror modes. (Thanks to Evan Anderson @ejdanderson)
  • The ‘_shortcode_processor’ function updated. The shortcode names are moved to a separate function.
  • The description in the Readme file updated.

2.19

  • Added auto-versioning of the CSS and JavaScript files to avoid cache issues.
  • CSS code in the file ‘admin.css’ is optimized.
  • Some texts corrected. Translation files updated.

2.18

  • Fixed the link “Settings”, located in the plugin’s meta row on the “Plugins” page. The suffix “.php” was deleted.
  • Fixed information stored in the header of the translation files.
  • Translation files updated.

2.17

  • Some texts updated, and typos corrected.
  • All translation files updated.
  • The information about the author of the plugin (including name, links, copyright, etc.) was changed due to the fact that the plugin became the property of SpaceXChimp.
  • The human.txt file updated.

2.16

  • Texts updated.
  • The year in the copyright text is updated.
  • The sidebar items are rearranged.
  • Translation files updated.

2.15

  • The plugin is fully tested for compatibility with WordPress version 4.9.
  • CSS code improved.

2.14

  • German translation added. (Thanks to Michael)
  • Spanish translation updated. (Thanks to Patricio Toledo)
  • Fixed an issue where the “Hello” message could not be hidden.

2.13

  • At the request of some users, plugin settings page moved to the submenu item in the top-level menu item “Settings”, like before.

2.12

  • Fixed the issue due to which the ‘Space X-Chimp’ sub menu item in the brand menu item was displayed.
  • Added branded footer text on the plugin’s settings page.

2.11

  • The hard coded HTML list options are replaced with the PHP function that dynamically creates lists.

2.10

  • Added the top level menu item of the brand.
  • The submenu item of the plugin has moved to the menu item of the brand.
  • The menu item of the plugin is renamed.
  • The “Author” tab on the settings page is removed.
  • Content of the “Support” tab on the settings page is updated.
  • Copyright of plugin files is changed to the “Space X-Chimp”.
  • The “Support” tab renamed to the “Support Me”.
  • The “Usage” tab renamed to the “Usage Instructions”.

2.9

  • Plugin data that saved in the database upgraded to version 0001.

2.8

  • Added Spanish translation. (Thanks Patricio Toledo)
  • Function that render controls on the settings page is moved to a separate file ‘controls.php’.
  • The ‘_setting’ function divided into two functions: ‘_control_field’ and ‘_control_switch’.
  • Added CSS class ‘control-switch’ to checkboxes with custom styles. Now the ‘bootstrap-checkbox.js’ plugin only applies to checkboxes with class ‘control-switch’.
  • The group name of the ‘_service_info’ option renamed to ‘_settings_group_si’.
  • The ‘admin.css’ file improved.
  • The “Font Awesome” library is integrated for use on the plugin settings page.
  • The save button is replaced by a new wider button.
  • Added an additional save button that fixed in the upper left corner.
  • The help text generating is moved to separate PHP function.
  • Prefixes of the PHP functions changed to ”spacexchimp_p010_.
  • Prefixes of the PHP constants changed to ”SPACEXCHIMP_P010_.

2.7

  • Russian translation updated. (Thanks to Milena Kiseleva)
  • The navigation of the tabs is rearranged.
  • Fixed an issue due to which the sidebar was not hiding on mobile devices.
  • Code of sidebar moved to separate file ‘sidebar.php’.
  • Support page tab moved from external source to plugin code.
  • My avatar moved from external source to plugin folder.
  • Banner moved from external source to plugin folder.
  • Code of PayPal button updated.

2.6

  • Stylesheet in the admin.css file improved.
  • The ‘!important’ declarations in the admin.css file removed.
  • Code formatting in the admin.js file improved.
  • Code commenting improved.
  • Load of the additional remote CSS file removed from the admin.js file.
  • Changed the sorting of enqueueing of scripts.
  • The ‘Family’ page tab renamed to ‘Store’.
  • Added ad banner of my store website.

2.5.1

  • The HTTPS mixed content issue fixed by changing all links to HTTPS.
  • Content of the “FAQ” section updated.

2.5

  • On the plugin settings page, text of buttons are corrected.
  • On the plugin settings page, the information about the plugin version number moved to header section.
  • Some mention of constants replaced with variables for easier access.
  • Content of the “Usage” tab updated.
  • Content of the “FAQ” tab updated.

2.4

  • To the plugin settings page added information about the plugin version number.
  • The “Tested up to:” comment changed to 4.8 after full testing process.
  • The “version.php” file renamed to “versioning.php”.
  • The “versioning.php” file updated to new version.
  • The “_plugin_version_number” function renamed to the “_versioning”.

2.3

  • Added option for adding dollar sign before every code line.
  • Numbers of lines centered.

2.2

  • Compatibility with PHP version 5.2 improved.
  • Added function for generating the plugin constants.
  • Some constants now get the value from the plugin header data.
  • The “_plugin_version_number” function improved.
  • Added file “upgrade.php” for future upgrades.

2.1.1

  • Fixed the bug due to which the “Warning: Constants may only evaluate to scalar values in” warning are displayed.

2.1

  • Added new constants: “_SLUG”, “_PREFIX”, “_SETTINGS” and “_NAME”.
  • Value of the “_VERSION” constant replaced with information from the plugin header data.
  • All references to the plugin name, slug, prefix are replaced with constants.
  • Added function that render checkboxes and fields for saving plugin settings to database.
  • Added prefix to the name of the variable in ‘wp_localize_script’ WordPress function, to prevent conflicts.
  • The “_load_scripts_base” function improved.
  • The dynamic CSS moved from the “mshighlighter_load_scripts_dynamic_css” function to the “mshighlighter_load_scripts_base”.
  • The “name” attribute removed from the “form” tag.
  • Code formatting improved.
  • F.A.Q. section updated.

2.0.2

  • Fixed the bug due to which the the “Warning: Illegal string offset ‘version’ in” and the “Warning: Illegal string offset ‘old_version’ in” warnings are displayed. (Thanks to Sven Brill)

2.0.1

  • The bug due to which the height of the lines was too high is fixed.

2.0

  • The design of the plugin settings page is completely redone.
  • Added additional donate link to the “Plugins” page.
  • Readme for translations updated.
  • Advertisement banner removed.
  • The ‘Using’ section renamed to ‘Usage’.
  • My Unicode signature added to the main file.
  • The ‘front.css’ file renamed to ‘frontend.css’.
  • The donate button replaced with new.
  • The ‘Donate’ section renamed to ‘Support’.
  • The ‘donate.png’ image removed.
  • Options from the settings page moved to a separate file.
  • Fixed a bug due to which the jQuery library was not loaded on the front end of the website if the visitor did not logged-in.
  • Added stylized descriptions of sections on the “Settings” tab.
  • Additional “Support” section added.
  • Added tab navigation menu for the settings page.
  • Added additional tabs on the settings page.
  • Added the CSS fix for height of line.
  • Code of the ‘admin.css’ file improved and better commented.
  • The ‘bootstrap-checkbox.min.js’ file renamed to ‘bootstrap-checkbox.js’.
  • A full version of the Bootstrap framework is integrated.
  • Added the CSS code for the custom list numbers on the plugin settings page.
  • The main font is changed to “Verdana”.
  • All PHP and HTML code is better formatted.
  • The header on the settings page of plugin is redesigned.
  • The “LICENSE.txt” file renamed to “license.txt”.
  • The “humans.txt” file added.
  • On the plugin settings page, the “valign=’top'” attribute removed from the “tr” element of HTML table and added the appropriate analog in CSS .
  • The “_service_info” setting added to the data-base.
  • Added function for managing information about the version number of the plugin.
  • Added the “Hello” message that show when the plugin is just installed.
  • Added the “Error” message that show when user is trying to degrade the version number of the plugin.
  • Fixed the parameter that contain the path to source files in all translation files.
  • The POT file updated.
  • Translations updated.

1.3

  • Added the Readme.txt file for translation contribution.
  • Added global constant for plugin text-domain.
  • Fixed the “Undefined variable: block_height” error.
  • Translations updated.
  • Ad banner replaced with new.

1.2

  • Added prefixes to the stylesheet and script names when using wp_enqueue_style() and wp_enqueue_script().
  • Added constant for storing the plugin version number.

1.1

  • Style sheet of settings page improved and better commented.
  • JS code improved.
  • Checkboxes replaced with cool triggers by using Bootstrap framework and Bootstrap-checkbox component.
  • Added the ability to use shortcodes in the text widgets.

1.0.1

  • POT file updated.
  • Russian translation updated.
  • Image “thanks.png” removed.
  • Advertisement replaced by new.
  • Added the subject with plugin name to email address on settings page.

1.0

  • The directory structure is changed. All files are moved to directories with names of file extensions.
  • Some changes in design of settings page.
  • [js], [xml], [scss], [less], [sass], [markdown], [perl], [sql], [mysql], [shell], [bash] shortcodes added.
  • Constants variables added.
  • Added function for preserve formatting of code.
  • Added option “Enable Plugin”.
  • Added option “Default language”.
  • Added option “Automatic height of code block”.
  • Added option “The height of code block”.
  • Text domain changed to “my-syntax-highlighter” and thus added compatibility with the translate.wordpress.org.
  • Plugin URI changed to GitHub repository.
  • POT file added.
  • Russian translation added.
  • Many more small changes.

0.3

  • Release candidate.
  • [php], [html], [css], [javascript] shortcodes added.
  • Added option “Display line numbers”.
  • Added option “First line number”.
  • Added option “Size of Tab”.
  • Image from plugin’s settings page changed.

0.2

  • Beta version.

0.1

  • Alpha version.